(self)
confirm shutdown on ^C

        A second ^C, or answering 'y' within 5s will cause shutdown,
        otherwise original SIGINT handler will be restored.

        This doesn't work on Windows.
confirm shutdown on ^C
confirm shutdown on ^C
def _confirm_exit(self):
        """confirm shutdown on ^C

        A second ^C, or answering 'y' within 5s will cause shutdown,
        otherwise original SIGINT handler will be restored.

        This doesn't work on Windows.
        """
        info = self.log.info
        info('interrupted')
        print(self.notebook_info())
        sys.stdout.write("Shutdown this notebook server (y/[n])? ")
        sys.stdout.flush()
        r,w,x = select.select([sys.stdin], [], [], 5)
        if r:
            line = sys.stdin.readline()
            if line.lower().startswith('y') and 'n' not in line.lower():
                self.log.critical("Shutdown confirmed")
                ioloop.IOLoop.instance().stop()
                return
        else:
            print("No answer for 5s:", end=' ')
        print("resuming operation...")
        # no answer, or answer is no:
        # set it back to original SIGINT handler
        # use IOLoop.add_callback because signal.signal must be called
        # from main thread
        ioloop.IOLoop.instance().add_callback(self._restore_sigint_handler)
def _confirm_exit ( self ) : info = self . log . info info ( 'interrupted' ) print ( self . notebook_info ( ) ) sys . stdout . write ( "Shutdown this notebook server (y/[n])? " ) sys . stdout . flush ( ) r , w , x = select . select ( [ sys . stdin ] , [ ] , [ ] , 5 ) if r : line = sys . stdin . readline ( ) if line . lower ( ) . startswith ( 'y' ) and 'n' not in line . lower ( ) : self . log . critical ( "Shutdown confirmed" ) ioloop . IOLoop . instance ( ) . stop ( ) return else : print ( "No answer for 5s:" , end = ' ' ) print ( "resuming operation..." ) # no answer, or answer is no: # set it back to original SIGINT handler # use IOLoop.add_callback because signal.signal must be called # from main thread ioloop . IOLoop . instance ( ) . add_callback ( self . _restore_sigint_handler )