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; }
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); }
public ConstrainedProcessTests() { ProcessKey = Guid.NewGuid(); HostClient = Substitute.For<IContainerHostClient>(); OutputCallback = delegate { }; ErrorCallback = delegate { }; Process = new ConstrainedProcess(HostClient, ProcessKey, 100, new Dictionary<string, string>()); }
public ConstrainedProcessTests() { ProcessKey = Guid.NewGuid(); HostClient = Substitute.For <IContainerHostClient>(); OutputCallback = delegate { }; ErrorCallback = delegate { }; Process = new ConstrainedProcess(HostClient, ProcessKey, 100, new Dictionary <string, string>()); }