コード例 #1
0
        public IProcess Run(ProcessRunSpec runSpec)
        {
            Guid processKey = Guid.NewGuid();

            var defaultEnvironmentBlock = EnvironmentBlock.CreateSystemDefault();
            var environment = defaultEnvironmentBlock.Merge(runSpec.Environment).ToDictionary();

            CreateProcessParams @params = new CreateProcessParams
            {
                key = processKey,
                executablePath = runSpec.ExecutablePath,
                arguments = runSpec.Arguments,
                environment = environment,
                workingDirectory = runSpec.WorkingDirectory
            };

            var processDataCallback = BuildProcessDataCallback(runSpec.OutputCallback, runSpec.ErrorCallback);

            hostClient.SubscribeToProcessData(processKey, processDataCallback);

            var result = hostClient.CreateProcess(@params);
            var process = new ConstrainedProcess(hostClient, processKey, result.id, environment);

            return process;
        }
コード例 #2
0
        public IProcess Run(ProcessRunSpec runSpec)
        {
            Guid processKey = Guid.NewGuid();

            var defaultEnvironmentBlock = EnvironmentBlock.CreateSystemDefault();
            var environment             = defaultEnvironmentBlock.Merge(runSpec.Environment).ToDictionary();

            CreateProcessParams @params = new CreateProcessParams
            {
                key              = processKey,
                executablePath   = runSpec.ExecutablePath,
                arguments        = runSpec.Arguments,
                environment      = environment,
                workingDirectory = runSpec.WorkingDirectory
            };

            var processDataCallback = BuildProcessDataCallback(runSpec.OutputCallback, runSpec.ErrorCallback);

            hostClient.SubscribeToProcessData(processKey, processDataCallback);

            var result  = hostClient.CreateProcess(@params);
            var process = new ConstrainedProcess(hostClient, processKey, result.id, environment);

            return(process);
        }
コード例 #3
0
        public ConstrainedProcessTests()
        {
            ProcessKey = Guid.NewGuid();

            HostClient = Substitute.For<IContainerHostClient>();

            OutputCallback = delegate { };
            ErrorCallback = delegate { };

            Process = new ConstrainedProcess(HostClient, ProcessKey, 100, new Dictionary<string, string>());
        }
コード例 #4
0
        public ConstrainedProcessTests()
        {
            ProcessKey = Guid.NewGuid();

            HostClient = Substitute.For <IContainerHostClient>();

            OutputCallback = delegate { };
            ErrorCallback  = delegate { };

            Process = new ConstrainedProcess(HostClient, ProcessKey, 100, new Dictionary <string, string>());
        }