/// <summary> /// Dispose of the process group /// </summary> public void Dispose() { if (JobHandle != null) { JobHandle.Dispose(); JobHandle = null; } }
public RestrictedProcessHandle(string processPath, string commandline) { myJobHandle = new JobHandle(); try { var cli = $"\"{processPath.Replace("\"", "")}\" {commandline}"; myProcessHandle = new ProcessHandle(cli, myJobHandle); } catch { myJobHandle.Dispose(); throw; } }
protected virtual void Dispose(bool disposing) { if (_isDisposed) { return; } if (disposing) { //Free managed objects here _jobHandle?.Dispose(); _jobHandle = null; } //Free unmanaged objects here _isDisposed = true; }
public void Dispose() { myJobHandle.Dispose(); myProcessHandle.Dispose(); }