7 ms·
I was bitten by this recentishly and I had to learn the difference between file descriptors and descriptions. I had a program that was misbehaving when talking
by gpderetta 3y ago
I was bitten by this recentishly and I had to learn the difference between file descriptors and descriptions. I had a program that was misbehaving when talking to a tty, but not when the output was piped through cat. Turns the program would set O_NONBLOCK (a description level property) on its input, but of course the shell was dup'ing the input tty fd to output as well, implicitly making the output non-blocking as well. Setting the output to a different description (i.e. the pipe) would workaround that.
- 392 3y agoFor a long time `npm` would do that to your stdout/in, which didn't impact anything in interactive shells because your shell resets it every time it shows the prompt, but run those same commands in a bash script and later processes will crash with strange error messages because no one has ever tested with stdout being nonblocking. So much for separate processes being independent.
- deleted 3y ago[deleted]