I often pipe program output to less, e.g.
produce_output | less
This works great, until produce_output
produces large amounts of output. If I search for some text that is deep into the file, less reports
Calculating line numbers... (interrupt to abort)
If I interrupt with Control+C, it also kills produce_output
, which stops it from producing further output. Is there any way to send the interrupt to less, so that produce_output
keeps running?
I know that I could use kill -INT less_process
, but I think there must be a better solution.
Answer
Normally all processes in a pipeline run in the same process group, causing all of them to receive the signal. You can use setsid foo | less
to run foo
in a different pgrp.
No comments:
Post a Comment