public function start(Context $context, array $args = []): Promise
    {
        $factory = $context->lookup(ProcessFactory::class);
        
        if ($factory === null) {
            throw new \RuntimeException('Cannot launch an async process without a process factory');
        }
        
        $options = [];
        
        foreach ($this->options as $k => $v) {
            if (\strlen($k) === 1) {
                $name = '-' . $k;
            } else {
                $name = '--' . $k;
            }
            
            if ($v === null) {
                $options[] = $name;
            } else {
                foreach ($v as $val) {
                    $options[] = $name;
                    $options[] = $val;
                }
            }
        }
        
        return $context->task($factory->createProcess($context, $this->command, \array_merge($options, $args), $this->dir, $this->env));
    }
public function start(Context $context, array $args = []): Promise
    {
        $factory = $context->lookup(ProcessFactory::class);
        
        if ($factory === null) {
            throw new \RuntimeException('Cannot launch an async process without a process factory');
        }
        
        $options = [];
        
        foreach ($this->options as $k => $v) {
            if (\strlen($k) === 1) {
                $name = '-' . $k;
            } else {
                $name = '--' . $k;
            }
            
            if ($v === null) {
                $options[] = $name;
            } else {
                foreach ($v as $val) {
                    $options[] = $name;
                    $options[] = $val;
                }
            }
        }
        
        return $context->task($factory->createProcess($context, $this->command, \array_merge($options, $args), $this->dir, $this->env));
    }
public function start ( Context $ context , array $ args = [ ] ) : Promise { $ factory = $ context -> lookup ( ProcessFactory :: class ) ; if ( $ factory === null ) { throw new \ RuntimeException ( 'Cannot launch an async process without a process factory' ) ; } $ options = [ ] ; foreach ( $ this -> options as $ k => $ v ) { if ( \ strlen ( $ k ) === 1 ) { $ name = '-' . $ k ; } else { $ name = '--' . $ k ; } if ( $ v === null ) { $ options [ ] = $ name ; } else { foreach ( $ v as $ val ) { $ options [ ] = $ name ; $ options [ ] = $ val ; } } } return $ context -> task ( $ factory -> createProcess ( $ context , $ this -> command , \ array_merge ( $ options , $ args ) , $ this -> dir , $ this -> env ) ) ; }
Start an instance of the configured process.

@param array $args Arguments to be passed to the process.
@return Process Provides access to the running process instance.

@throws \RuntimeException If the process could not be started.
Start an instance of the configured process .