##// END OF EJS Templates
Catch KeyboardInterrupt for !commands on Windows...
Thomas Kluyver -
Show More
@@ -2352,7 +2352,11 b' class InteractiveShell(SingletonConfigurable):'
2352 2352 if path is not None:
2353 2353 cmd = '"pushd %s &&"%s' % (path, cmd)
2354 2354 cmd = py3compat.unicode_to_str(cmd)
2355 ec = os.system(cmd)
2355 try:
2356 ec = os.system(cmd)
2357 except KeyboardInterrupt:
2358 self.write_err("\nKeyboardInterrupt\n")
2359 ec = -2
2356 2360 else:
2357 2361 cmd = py3compat.unicode_to_str(cmd)
2358 2362 # For posix the result of the subprocess.call() below is an exit
@@ -544,9 +544,9 b' class TestSystemRaw(unittest.TestCase, ExitCodeChecks):'
544 544 cmd = u'''python -c "'åäö'" '''
545 545 ip.system_raw(cmd)
546 546
547 @mock.patch('subprocess.call')
548 def test_control_c(self, call_mock):
549 call_mock.side_effect = KeyboardInterrupt()
547 @mock.patch('subprocess.call', side_effect=KeyboardInterrupt)
548 @mock.patch('os.system', side_effect=KeyboardInterrupt)
549 def test_control_c(self, *mocks):
550 550 try:
551 551 self.system("sleep 1 # wont happen")
552 552 except KeyboardInterrupt:
General Comments 0
You need to be logged in to leave comments. Login now