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