How to use the honcho.process.Popen function in honcho

To help you get started, we’ve selected a few honcho examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nickstenning / honcho / honcho / command.py View on Github external
os.environ.update(_read_env(args.app_root, args.env))

    argv = args.argv

    # If the first of the remaining args is '--', skip it.
    if argv and argv[0] == '--':
        argv = argv[1:]

    if compat.ON_WINDOWS:
        # do not quote on Windows, subprocess will handle it for us
        # using the MSFT quoting rules
        cmd = argv
    else:
        cmd = ' '.join(compat.shellquote(arg) for arg in argv)

    p = Popen(cmd, stdout=sys.stdout, stderr=sys.stderr,
              start_new_session=False)
    signal.signal(signal.SIGINT, signal.SIG_IGN)
    p.wait()
    sys.exit(p.returncode)
github deeplearninc / relaax / relaax / cmdl / commands / cmd_run.py View on Github external
\b
    For example:
        - run environment, rlx-server, parameter-server, metrics-server, and wsproxy
        $relaax run all
        - run rlx-server, parameter-server, metrics-server, and wsproxy
        $relaax run servers
    """
    ctx.setup_logger(format='%(asctime)s %(name)s\t\t  | %(message)s')
    # Disable TF warnings
    os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
    os.environ["COMSPEC"]= "powershell.exe"
    # Execute command
    if sys.platform == 'win32':
        honcho.manager.KILL_WAIT = 120
        honcho.process.Popen = PopenPatched
    
        import _winapi, ctypes
        
        firstRun = False 
        mutex = ctypes.windll.kernel32.CreateMutexA(None, False, "RELAAX_WINDOWS_MUTEX")
        if _winapi.GetLastError() == 0:
            firstRun1 = True
            
        if firstRun:
            os.system("start powershell " + ' '.join(sys.argv))
            time.sleep(5)
            _winapi.CloseHandle(mutex)
        else:
            _winapi.CloseHandle(mutex)    
            honcho.process.Popen = PopenPatched
            CmdlRun(ctx, set(components), config.name, n_environments, exploit, show_ui).run_components()
github deeplearninc / relaax / relaax / cmdl / commands / cmd_run.py View on Github external
honcho.process.Popen = PopenPatched
    
        import _winapi, ctypes
        
        firstRun = False 
        mutex = ctypes.windll.kernel32.CreateMutexA(None, False, "RELAAX_WINDOWS_MUTEX")
        if _winapi.GetLastError() == 0:
            firstRun1 = True
            
        if firstRun:
            os.system("start powershell " + ' '.join(sys.argv))
            time.sleep(5)
            _winapi.CloseHandle(mutex)
        else:
            _winapi.CloseHandle(mutex)    
            honcho.process.Popen = PopenPatched
            CmdlRun(ctx, set(components), config.name, n_environments, exploit, show_ui).run_components()
    else:    
        CmdlRun(ctx, set(components), config.name, n_environments, exploit, show_ui).run_components()
github nickstenning / honcho / honcho / process.py View on Github external
colour=None,
                 quiet=False,
                 env=None,
                 cwd=None):
        self.cmd = cmd
        self.colour = colour
        self.quiet = quiet
        self.name = name
        self.env = os.environ.copy() if env is None else env
        self.cwd = cwd

        # This is a honcho.environ.Env object, to allow for stubbing of
        # external calls, not the operating system environment.
        self._env = Env()
        self._child = None
        self._child_ctor = Popen
github nickstenning / honcho / honcho / process.py View on Github external
}
        options.update(**kwargs)

        if ON_WINDOWS:
            # MSDN reference:
            #   http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863%28v=vs.85%29.aspx
            create_new_process_group = 0x00000200
            detached_process = 0x00000008
            options.update(creationflags=detached_process | create_new_process_group)
        elif start_new_session:
            if sys.version_info < (3, 2):
                options.update(preexec_fn=os.setsid)
            else:
                options.update(start_new_session=True)

        super(Popen, self).__init__(cmd, **options)