public override void StartVMProcess(string BinaryPath, string[] args, bool hidden, int timeout) { VMObjects vo = Instanciate(); IGuestProcess ip = null; ip = vo.GSession.ProcessCreate(BinaryPath, args, new string[] { }, new ProcessCreateFlag[] { hidden?ProcessCreateFlag.ProcessCreateFlag_Hidden: ProcessCreateFlag.ProcessCreateFlag_None }, (uint)timeout); //ip.WaitFor((uint)ProcessWaitForFlag.ProcessWaitForFlag_Terminate, (uint)timeout); releaseObjects(vo); }
private static void WaitForExit(IGuestProcess echoTest) { while (echoTest.Status != ProcessStatus.ProcessStatus_TerminatedNormally && echoTest.Status != ProcessStatus.ProcessStatus_TerminatedAbnormally && echoTest.Status != ProcessStatus.ProcessStatus_Error) { Thread.Sleep(1000); } }
public override void StartVMProcess(string BinaryPath, string[] args, bool hidden, int timeout, Mutex m) { VMObjects vo = Instanciate(); IGuestProcess ip = null; ip = vo.GSession.ProcessCreate(BinaryPath, args, new string[] { }, new ProcessCreateFlag[] { hidden?ProcessCreateFlag.ProcessCreateFlag_Hidden: ProcessCreateFlag.ProcessCreateFlag_None }, (uint)timeout); m.ReleaseMutex(); ip.WaitFor((uint)ProcessWaitForFlag.ProcessWaitForFlag_Terminate, (uint)timeout); releaseObjects(vo); /*VMObjects vo = Instanciate(); * var ret = vo.GSession.ProcessCreate(BinaryPath, args, new string[] { }, new ProcessCreateFlag[] { hidden ? ProcessCreateFlag.ProcessCreateFlag_Hidden : ProcessCreateFlag.ProcessCreateFlag_None }, (uint)timeout); * m.ReleaseMutex(); * if(ret.Status == ProcessStatus.ProcessStatus_Started || ret.Status == ProcessStatus.ProcessStatus_Starting) * ret.WaitFor((uint)ProcessWaitForFlag.ProcessWaitForFlag_Terminate, (uint)timeout); * releaseObjects(vo); * if (ret.Status == ProcessStatus.ProcessStatus_Error) * throw new Exception("Error on start process " + BinaryPath);*/ }