Merge in 'release/6.0.1xx' changes

This commit is contained in:
dotnet-bot 2022-10-12 02:08:25 +00:00
commit 242c0b825d
2 changed files with 6 additions and 5 deletions

View file

@ -96,7 +96,7 @@ internal class DotNetHelper
}
}
public void ExecuteCmd(string args, string? workingDirectory = null, Action<Process>? additionalProcessConfigCallback = null, int expectedExitCode = 0, int millisecondTimeout = -1)
public void ExecuteCmd(string args, string? workingDirectory = null, Action<Process>? additionalProcessConfigCallback = null, int? expectedExitCode = 0, int millisecondTimeout = -1)
{
(Process Process, string StdOut, string StdErr) executeResult = ExecuteHelper.ExecuteProcess(
DotNetPath,
@ -105,7 +105,9 @@ internal class DotNetHelper
configure: (process) => configureProcess(process, workingDirectory),
millisecondTimeout: millisecondTimeout);
ExecuteHelper.ValidateExitCode(executeResult, expectedExitCode);
if (expectedExitCode != null) {
ExecuteHelper.ValidateExitCode(executeResult, (int) expectedExitCode);
}
void configureProcess(Process process, string? workingDirectory)
{

View file

@ -19,12 +19,11 @@ public class DotNetWatchTests : SmokeTests
string projectDirectory = DotNetHelper.ExecuteNew(DotNetTemplate.Console.GetName(), nameof(DotNetWatchTests));
bool outputChanged = false;
// We expect an exit code of 143 (128 + 15, i.e. SIGTERM) because we are killing the process manually
DotNetHelper.ExecuteCmd(
"watch run",
workingDirectory: projectDirectory,
additionalProcessConfigCallback: processConfigCallback,
expectedExitCode: 143,
expectedExitCode: null, // The exit code does not reflect whether or not dotnet watch is working properly
millisecondTimeout: 30000);
Assert.True(outputChanged);
@ -52,7 +51,7 @@ public class DotNetWatchTests : SmokeTests
{
outputChanged = true;
OutputHelper.WriteLine("Successfully re-ran program after code change.");
ExecuteHelper.ExecuteProcessValidateExitCode("kill", $"-s TERM {process.Id}", OutputHelper);
process.Kill(true);
}
});
}