You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have a process which outputs lots of logging on stdout and stderr, the nu docs say you could do "cmd out+err> [filename]" to pipe both into a file. This hangs and when you kill the process it ends up having around 64KB's of data in the output file flushed at the end, every time.
How to reproduce
Create a program called foo.c:
#include<stdio.h>intmain() {
// Should emit 1MiB on stderrfor (inti=0; i< (1024*1024) / 16; i++) {
fprintf(stderr, "0123456789ABCDE\n");
}
}
Compile with gcc foo.c
Run with ./a.out out+err> /tmp/foo.txt
Observe that it hangs, exit and observe /tmp/foo.txt filesize
Run with ./a.out err> /tmp/foo.txt
Observe that it doesn't hang and observe /tmp/foo.txt filesize
Expected behavior
It shouldn't hang when mixing out+err> pipe form and should populate the file the same as in the err> pipe case.
Yeah, it's because nu collects stdout, then stderr message sequentialy, a deadlock might happened if a program generates too much stderr messages. Currently a workaround would be redirecting them to different file like: cmd out> log.log err> err.log
Activity
fdncred commentedon Mar 22, 2023
IIRC, @WindSoilder understands what's going on here. There is some limitation that I don't fully understand.
WindSoilder commentedon Mar 22, 2023
Yeah, it's because nu collects stdout, then stderr message sequentialy, a deadlock might happened if a program generates too much stderr messages. Currently a workaround would be redirecting them to different file like:
cmd out> log.log err> err.log