diff --git a/source/Shellfish/ShellExecutor.cs b/source/Shellfish/ShellExecutor.cs index cf02d47..aefa927 100644 --- a/source/Shellfish/ShellExecutor.cs +++ b/source/Shellfish/ShellExecutor.cs @@ -164,7 +164,7 @@ void WriteData(Action action, ManualResetEventSlim resetEvent, DataRecei SafelyWaitForAllOutput(outputResetEvent, cancel, debug); SafelyWaitForAllOutput(errorResetEvent, cancel, debug); - var exitCode = SafelyGetExitCode(process); + var exitCode = SafelyGetExitCode(process, debug); debug($"Shellfish {exeFileNameOrFullPath} in {workingDirectory} exited with code {exitCode}"); running = false; @@ -178,7 +178,7 @@ void WriteData(Action action, ManualResetEventSlim resetEvent, DataRecei } } - static int SafelyGetExitCode(Process process) + static int SafelyGetExitCode(Process process, Action debug) { try { @@ -187,6 +187,7 @@ static int SafelyGetExitCode(Process process) catch (InvalidOperationException ex) when (ex.Message is "No process is associated with this object." || ex.Message is "Process was not started by this object, so requested information cannot be determined.") { + debug(ex.ToString()); return -1; } }