Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log exception to debug #85

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions source/Shellfish/ShellExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void WriteData(Action<string> 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;
Expand All @@ -178,7 +178,7 @@ void WriteData(Action<string> action, ManualResetEventSlim resetEvent, DataRecei
}
}

static int SafelyGetExitCode(Process process)
static int SafelyGetExitCode(Process process, Action<string> debug)
{
try
{
Expand All @@ -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;
}
}
Expand Down