From 341ba98d27741e231f8850e3534ae93f7a8de1c0 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Mon, 7 May 2018 10:52:47 -0700 Subject: [PATCH] [dotnet-watch] Don't show false error messages (#434) --- src/dotnet-watch/DotNetWatcher.cs | 8 ++++---- .../dotnet-watch.FunctionalTests/Scenario/WatchableApp.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/dotnet-watch/DotNetWatcher.cs b/src/dotnet-watch/DotNetWatcher.cs index 258ba0ab1e..f4b0423511 100644 --- a/src/dotnet-watch/DotNetWatcher.cs +++ b/src/dotnet-watch/DotNetWatcher.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; @@ -69,13 +69,13 @@ namespace Microsoft.DotNet.Watcher await Task.WhenAll(processTask, fileSetTask); - if (processTask.Result == 0) + if (processTask.Result != 0 && finishedTask == processTask) { - _reporter.Output("Exited"); + _reporter.Error($"Exited with error code {processTask.Result}"); } else { - _reporter.Error($"Exited with error code {processTask.Result}"); + _reporter.Output("Exited"); } if (finishedTask == cancelledTaskSource.Task || cancellationToken.IsCancellationRequested) diff --git a/test/dotnet-watch.FunctionalTests/Scenario/WatchableApp.cs b/test/dotnet-watch.FunctionalTests/Scenario/WatchableApp.cs index 56702afac2..4f2d575f01 100644 --- a/test/dotnet-watch.FunctionalTests/Scenario/WatchableApp.cs +++ b/test/dotnet-watch.FunctionalTests/Scenario/WatchableApp.cs @@ -47,7 +47,7 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests public async Task HasExited() { await Process.GetOutputLineAsync(ExitingMessage, DefaultMessageTimeOut); - await Process.GetOutputLineAsync(WatchExitedMessage, DefaultMessageTimeOut); + await Process.GetOutputLineStartsWithAsync(WatchExitedMessage, DefaultMessageTimeOut); } public async Task IsWaitingForFileChange()