mirror of
https://github.com/nushell/nushell.git
synced 2025-07-16 14:25:17 +02:00
# Description Partially handles #14799 It's difficult to fix all cases there, but I think it's good to improve one of this with a small step # User-Facing Changes Given the following code in c: ```C // write.c #include <stdio.h> int main() { while (1) { printf("a\n"); } } ``` After this pr, `./write | 0` will exit immediately, in that case, `./write` will receive `SIGPIPE` in unix. Before this pr, `./write | 0` runs indefinitely. ----------------------- Maybe it's easier to see what happened internally by the different output of `view ir { ./write | 0 }` command. ### Before ``` # 2 registers, 6 instructions, 7 bytes of data 0: load-literal %1, glob-pattern("./write", no_expand = false) 1: push-positional %1 2: redirect-out null 3: call decl 135 "run-external", %0 4: load-literal %0, int(0) 5: return %0 ``` ### After ``` # 2 registers, 6 instructions, 7 bytes of data 0: load-literal %1, glob-pattern("./write", no_expand = false) 1: push-positional %1 2: redirect-out pipe # changed, the command's output is a pipe rather than null 3: call decl 136 "run-external", %0 4: load-literal %0, int(0) 5: return %0 ``` # Tests + Formatting Added 1 test. # After Submitting NaN