Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(968)

Unified Diff: third_party/pexpect/tools/display-sighandlers.py

Issue 1398903002: Add third_party/pexpect (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@end-to-end-test
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/pexpect/tools/display-maxcanon.py ('k') | third_party/pexpect/tools/display-terminalinfo.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/pexpect/tools/display-sighandlers.py
diff --git a/third_party/pexpect/tools/display-sighandlers.py b/third_party/pexpect/tools/display-sighandlers.py
new file mode 100644
index 0000000000000000000000000000000000000000..f3559f72e31473ebf07b015996cdb470aaee0b17
--- /dev/null
+++ b/third_party/pexpect/tools/display-sighandlers.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+# Displays all signals, their values, and their handlers.
+from __future__ import print_function
+import signal
+FMT = '{name:<10} {value:<5} {description}'
+
+# header
+print(FMT.format(name='name', value='value', description='description'))
+print('-' * (33))
+
+for name, value in [(signal_name, getattr(signal, signal_name))
+ for signal_name in dir(signal)
+ if signal_name.startswith('SIG')
+ and not signal_name.startswith('SIG_')]:
+ try:
+ handler = signal.getsignal(value)
+ except ValueError:
+ # FreeBSD: signal number out of range
+ handler = 'out of range'
+ description = {
+ signal.SIG_IGN: "ignored(SIG_IGN)",
+ signal.SIG_DFL: "default(SIG_DFL)"
+ }.get(handler, handler)
+ print(FMT.format(name=name, value=value, description=description))
« no previous file with comments | « third_party/pexpect/tools/display-maxcanon.py ('k') | third_party/pexpect/tools/display-terminalinfo.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698