Skip to content

Ensure we start child processes created with ProcessManager #1177

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

Merged
merged 1 commit into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/shared/Core/ChildProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public ChildProcess(ITrace2 trace2, ProcessStartInfo startInfo)
Process.Exited += ProcessOnExited;
}

public void Start(Trace2ProcessClass processClass)
public bool Start(Trace2ProcessClass processClass)
{
ThrowIfDisposed();
// Record the time just before the process starts, since:
Expand All @@ -51,7 +51,7 @@ public void Start(Trace2ProcessClass processClass)
_startInfo.UseShellExecute,
_startInfo.FileName,
_startInfo.Arguments);
Process.Start();
return Process.Start();
}

public void WaitForExit() => Process.WaitForExit();
Expand Down
2 changes: 1 addition & 1 deletion src/shared/Core/Git.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public async Task<IDictionary<string, string>> InvokeHelperAsync(string args, ID
};

var process = _processManager.CreateProcess(procStartInfo);
if (process is null)
if (!process.Start(Trace2ProcessClass.Git))
{
var format = "Failed to start Git helper '{0}'";
var message = string.Format(format, args);
Expand Down
4 changes: 2 additions & 2 deletions src/shared/Core/Gpg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public string DecryptFile(string path)

using (var gpg = _processManager.CreateProcess(psi))
{
if (gpg is null)
if (!gpg.Start(Trace2ProcessClass.Other))
{
throw new Trace2Exception(_trace2, "Failed to start gpg.");
}
Expand Down Expand Up @@ -78,7 +78,7 @@ public void EncryptFile(string path, string gpgId, string contents)

using (var gpg = _processManager.CreateProcess(psi))
{
if (gpg is null)
if (!gpg.Start(Trace2ProcessClass.Other))
{
throw new Trace2Exception(_trace2, "Failed to start gpg.");
}
Expand Down