-
-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redirecting input of value-consuming builtin from file hangs #1010
Comments
The proximate cause is that the |
The problem is that the input redirection from a file is using a |
Note that the current behavior silently discards value output written to a file:
Note that there is no output from the I think that behavior is a mistake. Writing value output to a file, via redirection, should be a fatal error. The only question is whether it should cause a panic or cause an exception that it can be trapped by a |
The fix for this problem is literally a five line change (not counting comments). I'll work on adding a few regression tests tomorrow as well as updating the documentation. Then open a P.R. I'd still like to create a consensus regarding writing (discarding) value output redirected to a file. The current behavior is to silently discard the data. I think it should be an error but, for the moment, will retain the current behavior (which is why it's a five line rather than one line change). |
Surely you're joking when you suggest a panic here? IMO, panics are for internal elvish errors only, not for user errors. A user should not be able to crash or panic the shell except by sending it an actual SIGKILL og SIGSEGV or some such thing. But I think it may be a good idea to make it an exception. After all, the |
Not so much joking as pointing out that if the only options are to discard output the user probably expects to be written to the file or panic the panic is preferable. However, obviously there is a third option: Replace the use of BlackholeChan with a value sink that will result in an exception if it receives any values. In fact, it's not obvious that the current BlackholeChan is the correct behavior for any situation. I'll need to look at the couple of other places it is used. I've opened issue #1149 since I would prefer not to conflate that problem with this issue. |
This hangs:
OTOH
cat file | each $echo~
is fine.The text was updated successfully, but these errors were encountered: