HN
Hacker News
Top
New
Best
Ask
Show
Jobs
Comment by mr_mitm | Hacker News Reader
Parent
Full thread
mr_mitm
·
How could curl detect where it's piped to?
View on HN
take-five
·
Something like (in Python)
os.isatty(sys.stdout.fileno())
Zambyte
·
That doesn't say where it's piped though. It could be redirected to a file, or piped to something harmless like jq.
timando
·
Iterate through /proc/<pid>/fd and check for the pipe id in the symlink target.
Reply on news.ycombinator.com