Skip to content

Commit 6c2da1e

Browse files
committed
procmgr: ensure we start processes
Ensure that we actually start processes (and check they have started correctly) using the new ProcessManager/ChildProcess abstractions.
1 parent e36952e commit 6c2da1e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/shared/Core/ChildProcess.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public ChildProcess(ITrace2 trace2, ProcessStartInfo startInfo)
3636
Process.Exited += ProcessOnExited;
3737
}
3838

39-
public void Start(Trace2ProcessClass processClass)
39+
public bool Start(Trace2ProcessClass processClass)
4040
{
4141
ThrowIfDisposed();
4242
// Record the time just before the process starts, since:
@@ -51,7 +51,7 @@ public void Start(Trace2ProcessClass processClass)
5151
_startInfo.UseShellExecute,
5252
_startInfo.FileName,
5353
_startInfo.Arguments);
54-
Process.Start();
54+
return Process.Start();
5555
}
5656

5757
public void WaitForExit() => Process.WaitForExit();

src/shared/Core/Git.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public async Task<IDictionary<string, string>> InvokeHelperAsync(string args, ID
210210
};
211211

212212
var process = _processManager.CreateProcess(procStartInfo);
213-
if (process is null)
213+
if (!process.Start(Trace2ProcessClass.Git))
214214
{
215215
var format = "Failed to start Git helper '{0}'";
216216
var message = string.Format(format, args);

src/shared/Core/Gpg.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public string DecryptFile(string path)
4444

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

7979
using (var gpg = _processManager.CreateProcess(psi))
8080
{
81-
if (gpg is null)
81+
if (!gpg.Start(Trace2ProcessClass.Other))
8282
{
8383
throw new Trace2Exception(_trace2, "Failed to start gpg.");
8484
}

0 commit comments

Comments
 (0)