Catch SIGTERM for interruption.

Default signal sent by other program to gently terminates another one
is SIGTERM. So ninja should handle it.
Restart system call if they get interrupted by a signal.