3 ms·
My version of curl only prints the progress junk to stderr if you pipe stdout somewhere. I guess I've never had a problem since I don't use a pager usually. BT
by tlrobinson 17y ago
My version of curl only prints the progress junk to stderr if you pipe stdout somewhere. I guess I've never had a problem since I don't use a pager usually.
BTW, how do you detect whether your program's stdout is being piped to something other than the shell?
- 1amzave 17y ago> My version of curl only prints the progress junk to stderr if you pipe stdout somewhere. Hmm, good point -- I actually hadn't noticed that, and it seems to be the case on mine as well. (Though I rarely use it without piping or stdout-redirecting to something, so it still strikes me as inappropriate.) > BTW, how do you detect whether your program's stdout is being piped to something other than the shell? In the three languages I've used recently enough to remember: C: int isatty(int fd); /* from unistd.h */ Python: os.isatty Shell (bourne): [ -t 1 ] # exits 0 if stdout is a tty, 1 if not
- devinj 17y agoInstead of os.isatty(sys.stdout.fileno()) (ew) you should just use sys.stdout.isatty(). In addition to being shorter, it will work everywhere [that Python does], not just Unix.