catch SIGINT and SIGQUIT when run in foreground