File tree 2 files changed +8
-4
lines changed
src/BuiltInTools/dotnet-watch
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public static class Names
28
28
public static bool IsPollingEnabled => ReadBool ( "DOTNET_USE_POLLING_FILE_WATCHER" ) ;
29
29
public static bool SuppressEmojis => ReadBool ( "DOTNET_WATCH_SUPPRESS_EMOJIS" ) ;
30
30
public static bool RestartOnRudeEdit => ReadBool ( "DOTNET_WATCH_RESTART_ON_RUDE_EDIT" ) ;
31
- public static TimeSpan ProcessCleanupTimeout => ReadTimeSpan ( "DOTNET_WATCH_PROCESS_CLEANUP_TIMEOUT_MS" ) ;
31
+ public static TimeSpan ProcessCleanupTimeout => ReadTimeSpan ( "DOTNET_WATCH_PROCESS_CLEANUP_TIMEOUT_MS" , defaultValue : TimeSpan . FromSeconds ( 5 ) ) ;
32
32
33
33
public static string SdkRootDirectory =>
34
34
#if DEBUG
@@ -51,6 +51,6 @@ public static class Names
51
51
private static bool ReadBool ( string variableName )
52
52
=> Environment . GetEnvironmentVariable ( variableName ) is var value && ( value == "1" || bool . TryParse ( value , out var boolValue ) && boolValue ) ;
53
53
54
- private static TimeSpan ReadTimeSpan ( string variableName )
55
- => Environment . GetEnvironmentVariable ( variableName ) is var value && long . TryParse ( value , out var intValue ) && intValue >= 0 ? TimeSpan . FromMilliseconds ( intValue ) : TimeSpan . FromSeconds ( 5 ) ;
54
+ private static TimeSpan ReadTimeSpan ( string variableName , TimeSpan defaultValue )
55
+ => Environment . GetEnvironmentVariable ( variableName ) is var value && long . TryParse ( value , out var intValue ) && intValue >= 0 ? TimeSpan . FromMilliseconds ( intValue ) : defaultValue ;
56
56
}
Original file line number Diff line number Diff line change 5
5
using System . Diagnostics ;
6
6
using Microsoft . Build . Graph ;
7
7
using Microsoft . CodeAnalysis ;
8
+ using Microsoft . DotNet . Cli . Utils ;
8
9
9
10
namespace Microsoft . DotNet . Watch
10
11
{
@@ -218,8 +219,11 @@ void FileChangedCallback(ChangedPath change)
218
219
}
219
220
catch ( OperationCanceledException )
220
221
{
222
+ // Ctrl+C, forced restart, or process exited.
221
223
Debug . Assert ( iterationCancellationToken . IsCancellationRequested ) ;
222
- waitForFileChangeBeforeRestarting = false ;
224
+
225
+ // Will wait for a file change if process exited.
226
+ waitForFileChangeBeforeRestarting = true ;
223
227
break ;
224
228
}
225
229
You can’t perform that action at this time.
0 commit comments