@@ -52,8 +52,8 @@ public async Task Given_short_running_exe_then_should_run_to_exit()
52
52
_loggerFactory ,
53
53
ProcessRunType . SelfTerminating ,
54
54
Environment . CurrentDirectory ,
55
- "dotnet" ,
56
- "./SelfTerminatingProcess/Logicality.SelfTerminatingProcess.dll" ,
55
+ Constants . DotNet ,
56
+ Constants . SelfTerminatingProcessPath ,
57
57
envVars ) ;
58
58
supervisor . OutputDataReceived += data => _outputHelper . WriteLine2 ( data ) ;
59
59
var whenStateIsExited = supervisor . WhenStateIs ( ProcessSupervisor . State . ExitedSuccessfully ) ;
@@ -66,7 +66,7 @@ public async Task Given_short_running_exe_then_should_run_to_exit()
66
66
task . ShouldBe ( whenStateIsExited ) ;
67
67
supervisor . CurrentState . ShouldBe ( ProcessSupervisor . State . ExitedSuccessfully ) ;
68
68
supervisor . OnStartException . ShouldBeNull ( ) ;
69
- supervisor . ProcessInfo . ExitCode . ShouldBe ( 0 ) ;
69
+ supervisor . ProcessInfo ! . ExitCode . ShouldBe ( 0 ) ;
70
70
}
71
71
72
72
[ Fact ]
@@ -76,8 +76,8 @@ public async Task Given_non_terminating_process_then_should_exit_when_stopped()
76
76
_loggerFactory ,
77
77
ProcessRunType . NonTerminating ,
78
78
Environment . CurrentDirectory ,
79
- "dotnet" ,
80
- "./NonTerminatingProcess/Logicality.NonTerminatingProcess.dll" ) ;
79
+ Constants . DotNet ,
80
+ Constants . NonTerminatingProcessPath ) ;
81
81
supervisor . OutputDataReceived += data => _outputHelper . WriteLine2 ( $ "Process: { data } ") ;
82
82
var running = supervisor . WhenStateIs ( ProcessSupervisor . State . Running ) ;
83
83
await supervisor . Start ( ) ;
@@ -99,9 +99,9 @@ public async Task Can_restart_a_stopped_short_running_process()
99
99
_loggerFactory ,
100
100
ProcessRunType . SelfTerminating ,
101
101
Environment . CurrentDirectory ,
102
- "dotnet" ,
103
- "./SelfTerminatingProcess/Logicality.SelfTerminatingProcess.dll" ) ;
104
- supervisor . OutputDataReceived += data => _outputHelper . WriteLine2 ( data ) ;
102
+ Constants . DotNet ,
103
+ Constants . SelfTerminatingProcessPath ) ;
104
+ supervisor . OutputDataReceived += _outputHelper . WriteLine2 ;
105
105
var stateIsStopped = supervisor . WhenStateIs ( ProcessSupervisor . State . ExitedSuccessfully ) ;
106
106
await supervisor . Start ( ) ;
107
107
await stateIsStopped ;
@@ -117,9 +117,9 @@ public async Task Can_restart_a_stopped_long_running_process()
117
117
_loggerFactory ,
118
118
ProcessRunType . NonTerminating ,
119
119
Environment . CurrentDirectory ,
120
- "dotnet" ,
121
- "./NonTerminatingProcess/Logicality.NonTerminatingProcess.dll" ) ;
122
- supervisor . OutputDataReceived += data => _outputHelper . WriteLine2 ( data ) ;
120
+ Constants . DotNet ,
121
+ Constants . NonTerminatingProcessPath ) ;
122
+ supervisor . OutputDataReceived += _outputHelper . WriteLine2 ;
123
123
var exitedKilled = supervisor . WhenStateIs ( ProcessSupervisor . State . ExitedKilled ) ;
124
124
await supervisor . Start ( ) ;
125
125
await supervisor . Stop ( ) ;
@@ -139,9 +139,9 @@ public async Task When_stop_a_non_terminating_process_without_a_timeout_then_sho
139
139
_loggerFactory ,
140
140
ProcessRunType . NonTerminating ,
141
141
Environment . CurrentDirectory ,
142
- "dotnet" ,
143
- "./NonTerminatingProcess/Logicality.NonTerminatingProcess.dll" ) ;
144
- supervisor . OutputDataReceived += data => _outputHelper . WriteLine2 ( data ) ;
142
+ Constants . DotNet ,
143
+ Constants . NonTerminatingProcessPath ) ;
144
+ supervisor . OutputDataReceived += _outputHelper . WriteLine2 ;
145
145
var stateIsStopped = supervisor . WhenStateIs ( ProcessSupervisor . State . ExitedKilled ) ;
146
146
await supervisor . Start ( ) ;
147
147
await supervisor . Stop ( ) ; // No timeout so will just kill the process
@@ -157,15 +157,15 @@ public async Task When_stop_a_non_terminating_process_that_does_not_shutdown_wit
157
157
_loggerFactory ,
158
158
ProcessRunType . NonTerminating ,
159
159
Environment . CurrentDirectory ,
160
- "dotnet" ,
161
- "./NonTerminatingProcess/Logicality.NonTerminatingProcess.dll --ignore-shutdown-signal=true") ;
162
- supervisor . OutputDataReceived += data => _outputHelper . WriteLine2 ( data ) ;
160
+ Constants . DotNet ,
161
+ $ " { Constants . NonTerminatingProcessPath } --ignore-shutdown-signal=true") ;
162
+ supervisor . OutputDataReceived += _outputHelper . WriteLine2 ;
163
163
var stateIsKilled = supervisor . WhenStateIs ( ProcessSupervisor . State . ExitedKilled ) ;
164
164
await supervisor . Start ( ) ;
165
165
await supervisor . Stop ( TimeSpan . FromSeconds ( 2 ) ) ;
166
166
await stateIsKilled . TimeoutAfter ( TimeSpan . FromSeconds ( 5 ) ) ;
167
167
168
- _outputHelper . WriteLine ( $ "Exit code { supervisor . ProcessInfo . ExitCode } ") ;
168
+ _outputHelper . WriteLine ( $ "Exit code { supervisor . ProcessInfo ! . ExitCode } ") ;
169
169
}
170
170
171
171
[ Fact ]
@@ -175,14 +175,14 @@ public async Task When_stop_a_non_terminating_process_with_non_zero_then_should_
175
175
_loggerFactory ,
176
176
ProcessRunType . NonTerminating ,
177
177
Environment . CurrentDirectory ,
178
- "dotnet" ,
179
- "./NonTerminatingProcess/Logicality.NonTerminatingProcess.dll --exit-with-non-zero=true") ;
180
- supervisor . OutputDataReceived += data => _outputHelper . WriteLine2 ( data ) ;
178
+ Constants . DotNet ,
179
+ $ " { Constants . NonTerminatingProcessPath } --exit-with-non-zero=true") ;
180
+ supervisor . OutputDataReceived += _outputHelper . WriteLine2 ;
181
181
var stateExitWithError = supervisor . WhenStateIs ( ProcessSupervisor . State . ExitedWithError ) ;
182
182
await supervisor . Start ( ) ;
183
183
await supervisor . Stop ( TimeSpan . FromSeconds ( 5 ) ) ;
184
184
await stateExitWithError . TimeoutAfter ( TimeSpan . FromSeconds ( 5 ) ) ;
185
- supervisor . ProcessInfo . ExitCode . ShouldNotBe ( 0 ) ;
185
+ supervisor . ProcessInfo ! . ExitCode . ShouldNotBe ( 0 ) ;
186
186
187
187
_outputHelper . WriteLine ( $ "Exit code { supervisor . ProcessInfo . ExitCode } ") ;
188
188
}
0 commit comments