I have a program which prints some info to stdout and I run it like so:
watch -n 0.1 myprogram
My problem is that I need myprogram
to exit cleanly, calling appropriate destructors to release system-wide mutexes. If I press CTRL+C, then watch
is killed and myprogram
isn't given the chance to exit cleanly.
Is there a way to exit watch
cleanly so that it waits for the child process to finish before returning?
The man
page simply says:
watch will run until interrupted
watch
. – phemmer May 17 '18 at 12:56