Skip to content

Commit a020a63

Browse files
committed
Remove IChildProcess.IsSuccessful since it offers little functionality and is slightly vague.
1 parent 7d19681 commit a020a63

File tree

6 files changed

+10
-20
lines changed

6 files changed

+10
-20
lines changed

src/ChildProcess.Test/ProcessManagement/ChildProcessExecutionTestUtil.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static string ExecuteForStandardOutput(ChildProcessStartInfo si, Encoding
2626
var standardOutput = sr.ReadToEnd();
2727
p.WaitForExit();
2828

29-
if (!p.IsSuccessful)
29+
if (p.ExitCode != 0)
3030
{
3131
throw new ChildProcessFailedException($"Child process failed with exit code {p.ExitCode} (0x{p.ExitCode:X8}).");
3232
}

src/ChildProcess.Test/ProcessManagement/ChildProcessTest_Performance.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public void ChildProcessWaitForAsyncIsTrulyAsynchronous()
2323
using var sut = ChildProcess.Start(si);
2424
WaitForAsyncIsTrulyAsynchronous(sut);
2525
sut.WaitForExit();
26-
Assert.True(sut.IsSuccessful);
26+
Assert.Equal(0, sut.ExitCode);
2727
}
2828

2929
private static void WaitForAsyncIsTrulyAsynchronous(IChildProcess sut)

src/ChildProcess.Test/ProcessManagement/ChildProcessTest_Redirection.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ public void RedirectionToFile()
288288
using (var sut = ChildProcess.Start(si))
289289
{
290290
sut.WaitForExit();
291-
Assert.True(sut.IsSuccessful);
291+
Assert.Equal(0, sut.ExitCode);
292292
}
293293

294294
Assert.Equal("TestChild.Out", File.ReadAllText(outFile));
@@ -306,7 +306,7 @@ public void RedirectionToFile()
306306
using (var sut = ChildProcess.Start(si))
307307
{
308308
sut.WaitForExit();
309-
Assert.True(sut.IsSuccessful);
309+
Assert.Equal(0, sut.ExitCode);
310310
}
311311

312312
Assert.Equal("TestChild.OutTestChild.Error", File.ReadAllText(outFile));
@@ -329,7 +329,7 @@ public void RedirectionToFile()
329329
using (var sut = ChildProcess.Start(si))
330330
{
331331
sut.WaitForExit();
332-
Assert.True(sut.IsSuccessful);
332+
Assert.Equal(0, sut.ExitCode);
333333
}
334334

335335
Assert.Equal(text, File.ReadAllText(outFile));
@@ -356,7 +356,7 @@ public void CanRedirectToSameFile()
356356
using (var sut = ChildProcess.Start(si))
357357
{
358358
sut.WaitForExit();
359-
Assert.True(sut.IsSuccessful);
359+
Assert.Equal(0, sut.ExitCode);
360360
}
361361

362362
Assert.Equal("TestChild.OutTestChild.Error", File.ReadAllText(outFile));
@@ -373,7 +373,7 @@ public void CanRedirectToSameFile()
373373
using (var sut = ChildProcess.Start(si))
374374
{
375375
sut.WaitForExit();
376-
Assert.True(sut.IsSuccessful);
376+
Assert.Equal(0, sut.ExitCode);
377377
}
378378

379379
Assert.Equal("TestChild.OutTestChild.ErrorTestChild.OutTestChild.Error", File.ReadAllText(outFile));
@@ -404,7 +404,7 @@ public void RedirectionToHandle()
404404

405405
using var sut = ChildProcess.Start(si);
406406
sut.WaitForExit();
407-
Assert.True(sut.IsSuccessful);
407+
Assert.Equal(0, sut.ExitCode);
408408
}
409409

410410
Assert.Equal("TestChild.Out", File.ReadAllText(outFile));
@@ -428,7 +428,7 @@ public void RedirectionToHandle()
428428

429429
using var sut = ChildProcess.Start(si);
430430
sut.WaitForExit();
431-
Assert.True(sut.IsSuccessful);
431+
Assert.Equal(0, sut.ExitCode);
432432
}
433433

434434
Assert.Equal(text, File.ReadAllText(outFile));

src/ChildProcess.Test/ProcessManagement/ChildProcessTest_Waiting.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public void CanObtainExitCode()
2424

2525
using var sut = ChildProcess.Start(si);
2626
sut.WaitForExit();
27-
Assert.True(sut.IsSuccessful);
2827
Assert.Equal(0, sut.ExitCode);
2928
}
3029

@@ -40,7 +39,7 @@ public void CanObtainExitCode()
4039

4140
using var sut = ChildProcess.Start(si);
4241
sut.WaitForExit();
43-
Assert.False(sut.IsSuccessful);
42+
Assert.NotEqual(0, sut.ExitCode);
4443
Assert.Equal(nonZeroExitCode, sut.ExitCode);
4544
}
4645
}
@@ -54,13 +53,11 @@ public void ExitCodeThrowsBeforeChildExits()
5453
};
5554

5655
using var sut = ChildProcess.Start(si);
57-
Assert.Throws<InvalidOperationException>(() => sut.IsSuccessful);
5856
Assert.Throws<InvalidOperationException>(() => sut.ExitCode);
5957

6058
sut.StandardInput.Close();
6159
sut.WaitForExit();
6260

63-
Assert.True(sut.IsSuccessful);
6461
Assert.Equal(0, sut.ExitCode);
6562
}
6663

src/ChildProcess/ProcessManagement/ChildProcessImpl.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ public void Dispose()
5050
}
5151
}
5252

53-
public bool IsSuccessful => ExitCode == 0;
5453
public bool HasStandardInput => _standardInput is not null;
5554
public bool HasStandardOutput => _standardOutput is not null;
5655
public bool HasStandardError => _standardError is not null;

src/ChildProcess/ProcessManagement/IChildProcess.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ public interface IChildProcess : IDisposable
3434
/// </remarks>
3535
int Id { get; }
3636

37-
/// <summary>
38-
/// Gets a value indicating whether the exit code of the process is 0.
39-
/// </summary>
40-
/// <exception cref="InvalidOperationException">The process has not exited yet.</exception>
41-
bool IsSuccessful { get; }
42-
4337
/// <summary>
4438
/// <para>Gets the exit code of the process.</para>
4539
/// <para>(Non-Windows-Specific) If the process was terminated by signal N, the exit code will be -N.</para>

0 commit comments

Comments
 (0)