From 25f5afd39fb4b32dc68c0c3f72744ddef6a503cd Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Wed, 10 Jun 2015 14:39:38 -0700 Subject: [PATCH] Die immediately on SIGINT if not in a tty Closes gh-146 --- notebook/notebookapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index 9e29aa280..4503eee60 100644 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -894,7 +894,7 @@ class NotebookApp(JupyterApp): log("Terminals not available (error was %s)", e) def init_signal(self): - if not sys.platform.startswith('win'): + if not sys.platform.startswith('win') and sys.stdin.isatty(): signal.signal(signal.SIGINT, self._handle_sigint) signal.signal(signal.SIGTERM, self._signal_stop) if hasattr(signal, 'SIGUSR1'):