/// <exception cref="System.IO.IOException"/> public virtual void Execute() { if (state != WindowsSecureContainerExecutor.WintuilsProcessStubExecutor.State.Init) { throw new IOException("Process is already started"); } processStub = WindowsSecureContainerExecutor.Native.CreateTaskAsUser(cwd, jobName , userName, pidFile, cmdLine); state = WindowsSecureContainerExecutor.WintuilsProcessStubExecutor.State.Running; Sharpen.Thread stdOutReader = StartStreamReader(processStub.GetInputStream()); Sharpen.Thread stdErrReader = StartStreamReader(processStub.GetErrorStream()); try { processStub.Resume(); processStub.WaitFor(); stdOutReader.Join(); stdErrReader.Join(); } catch (Exception ie) { throw new IOException(ie); } exitCode = processStub.ExitValue(); state = WindowsSecureContainerExecutor.WintuilsProcessStubExecutor.State.Complete; }
public WintuilsProcessStubExecutor(string cwd, string jobName, string userName, string pidFile, string cmdLine) { this.cwd = cwd; this.jobName = jobName; this.userName = userName; this.pidFile = pidFile; this.cmdLine = cmdLine; this.state = WindowsSecureContainerExecutor.WintuilsProcessStubExecutor.State.Init; }