Example #1
0
        public CreateRemoteProcessCommandHandler(
            IBus bus,
            IWin32ProcessRepository win32ProcessRepository,
            IRemoteProcessFactory remoteProcessFactory,
            IRemoteProcessRepository remoteProcessRepository)
        {
            Contract.Requires <ArgumentNullException>(bus != null);
            Contract.Requires <ArgumentNullException>(win32ProcessRepository != null);
            Contract.Requires <ArgumentNullException>(remoteProcessFactory != null);
            Contract.Requires <ArgumentNullException>(remoteProcessRepository != null);

            this.bus = bus;
            this.win32ProcessRepository  = win32ProcessRepository;
            this.remoteProcessFactory    = remoteProcessFactory;
            this.remoteProcessRepository = remoteProcessRepository;
        }
        public async Task <IRemoteProcessPip> CreateAndStartAsync(RemoteProcessInfo processInfo, CancellationToken cancellationToken)
        {
            Contract.Requires(IsInitialized);

            IRemoteProcessFactory factory = (await m_initResultLazy.GetValueAsync()).RemoteProcessFactory;
            var commandInfo = new RemoteCommandExecutionInfo(
                processInfo.Executable,
                processInfo.Args,
                processInfo.WorkingDirectory,
                useLocalEnvironment: false,
                processInfo.Environments.ToList());

            try
            {
                IRemoteProcess remoteCommand = await factory.CreateAndStartAsync(commandInfo, cancellationToken);

                return(new AnyBuildRemoteProcess(remoteCommand));
            }
            catch (Exception e)
            {
                return(new ErrorRemoteProcessPip(e.ToString()));
            }
        }
 private record InitResult(AnyBuildClient AbClient, AnyBuildDaemonManager DaemonManager, IRemoteProcessFactory RemoteProcessFactory);