How to make this interruptable with ctrl-c?
# Makefile
foo:
timeout 1m bash -c "while true; do date; sleep 1; done"
GNU Make 4.3
You have to run timeout
with the --foreground
option; see the man page:
--foreground
when not running timeout directly from a shell prompt,
allow COMMAND to read from the TTY and get TTY signals; in this
mode, children of COMMAND will not be timed out
Since you're running timeout
from inside a makefile, which is not directly from a shell prompt, you need this to allow it to receive TTY signals (like CTRL-C).