Ticket #273: wcw - only start in winswitch option.patch

File wcw - only start in winswitch option.patch, 1.4 KB (added by Nathan Rennie-Waldock, 9 years ago)
  • winswitch/net/command_wrapper.py

     
    88import os
    99
    1010VERBOSE_FLAG = "--winswitch-verbose"
     11WINSWITCH_ONLY_FLAG = "--winswitch-only"
    1112
    1213verbose = VERBOSE_FLAG in sys.argv
    1314if verbose:
    1415        sys.argv.remove(VERBOSE_FLAG)
     16winswitch_only = WINSWITCH_ONLY_FLAG in sys.argv
     17if winswitch_only:
     18        sys.argv.remove(WINSWITCH_ONLY_FLAG)
     19
    1520from winswitch.util.simple_logger import set_log_to_tty
    1621set_log_to_tty(verbose)
    1722
     
    2227        print("  arguments                Optional arguments for the command")
    2328        print("  -h  --help               This information")
    2429        print("  --winswitch-verbose      Turn on verbose logging")
     30        print("  --winswitch-only         Do not start commands outside Window Switch")
    2531        print("")
    2632        print("This is a wrapper script for launching commands")
    2733        print("via Window Switch.")
     
    6672        except Exception, e:
    6773                print("%s: error sending to client: %s" % (sys.argv[0], e))
    6874                return  False
     75               
    6976
    70 
    7177def execute_command(argv):
    7278        if start_via_client(argv):
    7379                return  0
     80        elif winswitch_only:
     81                print("failed to start inside Window Switch")
     82                print("Giving up as requested")
     83                return 1
     84
    7485        #socket failed to send, so start the command directly
    7586        os.execvp(argv[0], argv)
    7687