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

Unified Diff: native_client_sdk/src/tools/oshelpers.py

Issue 16022005: [NaCl SDK] Add keyboard interrupt handlers for python scripts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | « native_client_sdk/src/tools/create_nmf.py ('k') | native_client_sdk/src/tools/tests/oshelpers_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/tools/oshelpers.py
diff --git a/native_client_sdk/src/tools/oshelpers.py b/native_client_sdk/src/tools/oshelpers.py
index 2ae8c4a2f3ce83f955584ea27152f3d67ca44811..e73f5cf9005efe7c73cef8f90de696dc3f37bd19 100755
--- a/native_client_sdk/src/tools/oshelpers.py
+++ b/native_client_sdk/src/tools/oshelpers.py
@@ -525,12 +525,17 @@ def main(args):
print 'No command specified'
print 'Available commands: %s' % ' '.join(FuncMap)
return 1
- func = FuncMap.get(args[0])
+ func_name = args[0]
+ func = FuncMap.get(func_name)
if not func:
- print 'Do not recognize command: ' + args[0]
+ print 'Do not recognize command: %s' % func_name
print 'Available commands: %s' % ' '.join(FuncMap)
return 1
- return func(args[1:])
+ try:
+ return func(args[1:])
+ except KeyboardInterrupt:
+ print '%s: interrupted' % func_name
+ return 1
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
« no previous file with comments | « native_client_sdk/src/tools/create_nmf.py ('k') | native_client_sdk/src/tools/tests/oshelpers_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698