Ticket #273: wcw - only start in winswitch option.patch
File wcw - only start in winswitch option.patch, 1.4 KB (added by , 10 years ago) |
---|
-
winswitch/net/command_wrapper.py
8 8 import os 9 9 10 10 VERBOSE_FLAG = "--winswitch-verbose" 11 WINSWITCH_ONLY_FLAG = "--winswitch-only" 11 12 12 13 verbose = VERBOSE_FLAG in sys.argv 13 14 if verbose: 14 15 sys.argv.remove(VERBOSE_FLAG) 16 winswitch_only = WINSWITCH_ONLY_FLAG in sys.argv 17 if winswitch_only: 18 sys.argv.remove(WINSWITCH_ONLY_FLAG) 19 15 20 from winswitch.util.simple_logger import set_log_to_tty 16 21 set_log_to_tty(verbose) 17 22 … … 22 27 print(" arguments Optional arguments for the command") 23 28 print(" -h --help This information") 24 29 print(" --winswitch-verbose Turn on verbose logging") 30 print(" --winswitch-only Do not start commands outside Window Switch") 25 31 print("") 26 32 print("This is a wrapper script for launching commands") 27 33 print("via Window Switch.") … … 66 72 except Exception, e: 67 73 print("%s: error sending to client: %s" % (sys.argv[0], e)) 68 74 return False 75 69 76 70 71 77 def execute_command(argv): 72 78 if start_via_client(argv): 73 79 return 0 80 elif winswitch_only: 81 print("failed to start inside Window Switch") 82 print("Giving up as requested") 83 return 1 84 74 85 #socket failed to send, so start the command directly 75 86 os.execvp(argv[0], argv) 76 87