On 26/06/11 20:20, shay shimony wrote: > Hello coreutils team, > > I found that if you run timeout inside make file then CTRL-C doesn't work. > Really frustrating because I use timeout to terminate deadlocked tests, but > can't stop them with CTRL-C as I used to. > > To reproduce copy the following into file named Makefile: > > all: > timeout 12 sleep 10 > > Note there is a tab before "timeout 12 sleep 10". > Then run at same directory where the file is located "make" and try to press > CTRL-C. > > Notes: > CTRL-Z works. > When executing timeout without make CTRL-C works. > When executing make without timeout CTRL-C works.
Drats, That because SIGINT is sent by the terminal to the foreground group. The issue is that `make` and `timeout` use much the same method to control their jobs. I.E. they create their own process group so they can terminate all sub-processes. So in your case, make creates its own program group and is in the foreground. Because timeout does too, it will not get SIGINT from the terminal. Really `make` should propagate the SIGINT down, though I suppose the same thing could be said for `timeout`. I.E. the following demonstrates the same issue and times out after 10s and is also unresponsive to CTRL-C: timeout 5 timeout 10 sleep 20 Note a handy way to see the process structure of timeout and make is: ps -C make -C timeout -o ppid,pgid,pgrp,pid,tty,sess,comm So what to do. The cascaded timeouts could be handled by timeout sending a signal to the child process as well as the process group. But that won't fix the make case as `make` would have to do something similar. Maybe I could add an option to not create a separate group. I'll need to think a bit about this. cheers, Pádraig.