Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
mr_mitm
· 2y ago · 0 comments
How could curl detect where it's piped to?
Comments
[–]
take-five
2y ago
Something like (in Python)
os.isatty(sys.stdout.fileno())
[–]
Zambyte
2y ago
That doesn't say where it's piped though. It could be redirected to a file, or piped to something harmless like jq.
[–]
timando
2y ago
Iterate through /proc/<pid>/fd and check for the pipe id in the symlink target.