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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import fnmatch 6 import fnmatch
7 import glob 7 import glob
8 import optparse 8 import optparse
9 import os 9 import os
10 import posixpath 10 import posixpath
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 'zip': Zip, 518 'zip': Zip,
519 'which': Which, 519 'which': Which,
520 } 520 }
521 521
522 522
523 def main(args): 523 def main(args):
524 if not args: 524 if not args:
525 print 'No command specified' 525 print 'No command specified'
526 print 'Available commands: %s' % ' '.join(FuncMap) 526 print 'Available commands: %s' % ' '.join(FuncMap)
527 return 1 527 return 1
528 func = FuncMap.get(args[0]) 528 func_name = args[0]
529 func = FuncMap.get(func_name)
529 if not func: 530 if not func:
530 print 'Do not recognize command: ' + args[0] 531 print 'Do not recognize command: %s' % func_name
531 print 'Available commands: %s' % ' '.join(FuncMap) 532 print 'Available commands: %s' % ' '.join(FuncMap)
532 return 1 533 return 1
533 return func(args[1:]) 534 try:
535 return func(args[1:])
536 except KeyboardInterrupt:
537 print '%s: interrupted' % func_name
538 return 1
534 539
535 if __name__ == '__main__': 540 if __name__ == '__main__':
536 sys.exit(main(sys.argv[1:])) 541 sys.exit(main(sys.argv[1:]))
OLDNEW
« 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