Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
0 points
mr_mitm
2y ago
0 comments
Save
Share
How could curl detect where it's piped to?
0 comments
3 comments · 2 top-level
top
newest
oldest
take-five
2y ago
· 1 in thread
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.
j
/
k
navigate · click thread line to collapse