bool OnOutputMonitorElapsed(Process process, ProcessState state, TimeSpan timeout) { if (TryCheckHasExited(process)) { return(false); } var lastResponse = state.Stamp; if (!Tools.Generic.LongerAgoThan(lastResponse, timeout)) { return(true); } var lastStreamLengths = state.StreamLengths; state.StreamLengths = Tuple.Create(TryGetLength(process.StandardOutput.BaseStream), TryGetLength(process.StandardError.BaseStream)); if ((state.StreamLengths.Item1 != lastStreamLengths.Item1) || (state.StreamLengths.Item2 != lastStreamLengths.Item2)) { state.UpdateStamp(); return(true); } TryKillDueToNoOutputReceivedTimeout(process, timeout); return(false); }
bool OnMonitorElapsed(Process process, ProcessState state, TimeSpan timeout) { var hasExited = TryCheckHasExited(process); if (hasExited) { return(false); } if (TryCheckResponding(process)) { state.UpdateStamp(); return(true); } if (Tools.Generic.LongerAgoThan(state.Stamp, timeout)) { TryKillDueNotRespondingTimeout(process, timeout); } return(false); }
bool OnMonitorElapsed(Process process, ProcessState state, TimeSpan timeout) { var hasExited = TryCheckHasExited(process); if (hasExited) return false; if (TryCheckResponding(process)) { state.UpdateStamp(); return true; } if (Tools.Generic.LongerAgoThan(state.Stamp, timeout)) TryKillDueNotRespondingTimeout(process, timeout); return false; }
bool OnOutputMonitorElapsed(Process process, ProcessState state, TimeSpan timeout) { if (TryCheckHasExited(process)) return false; var lastResponse = state.Stamp; if (!Tools.Generic.LongerAgoThan(lastResponse, timeout)) return true; var lastStreamLengths = state.StreamLengths; state.StreamLengths = new Tuple<long, long>(process.StandardOutput.BaseStream.Length, process.StandardError.BaseStream.Length); if (state.StreamLengths.Item1 != lastStreamLengths.Item1 || state.StreamLengths.Item2 != lastStreamLengths.Item2) { state.UpdateStamp(); return true; } TryKillDueToNoOutputReceivedTimeout(process, timeout); return false; }