8 examples of 'python keyboardinterrupt' in Python

Every line of 'python keyboardinterrupt' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
63def interrupt_(event):
64 event.app.exit(exception=KeyboardInterrupt, style='class:aborting')

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

31def _handle_interrupt(signum, frame):
32 click.echo('Exiting upon user request!')
33 sys.exit(0)
31def on_interrupt(signum, frame):
32 # It's necessary to release lockfile
33 sys.exit()
83def handleKeyboardInterrupt(signalNumer, frame):
84 for t in threads:
85 t.stop()
126def KeyboardInterruptHandler(_signal, _frame):
127 print("Ctrl-C detected")
128 engine.shutdown()
129 sys.exit(0)
390def on_interrupt(self, node): # ()
391 """Interrupt handler."""
392 self._interrupt = node
393 return node
159def interrupt(self):
160 "Interrupt a running process. Return the exit value."
161 s = self._intf
162 fo = s.fileobject()
163 fo.interrupt()
164 s.wait_for_prompt()
165 s.send("echo $?\r")
166 s.readline()
167 ret = s.readline()
168 s.wait_for_prompt()
169 ret = ExitStatus("<interrupted process>", int(ret)<<8)
170 return ret
109def test_interrupt(self, monkeypatch):
110 def my_raise(*args):
111 raise KeyboardInterrupt()
112 mock_cmd = Mock(side_effect=my_raise)
113 monkeypatch.setattr(Run, "execute", mock_cmd)
114 pytest.raises(KeyboardInterrupt, cmd_main, [])

Related snippets