@@ -27,7 +27,7 @@ extension RunnerTests {
2727
2828 func execute( command: Command ) throws -> Response {
2929 if command. command == . status {
30- return try executeDispatched ( command: command)
30+ return executeStatus ( command: command)
3131 }
3232 commandJournal. accept ( command: command)
3333 commandJournal. start ( command: command)
@@ -41,6 +41,17 @@ extension RunnerTests {
4141 }
4242 }
4343
44+ private func executeStatus( command: Command ) -> Response {
45+ guard
46+ let statusCommandId = command. statusCommandId?
47+ . trimmingCharacters ( in: . whitespacesAndNewlines) ,
48+ !statusCommandId. isEmpty
49+ else {
50+ return Response ( ok: false , error: ErrorPayload ( message: " status requires statusCommandId " ) )
51+ }
52+ return Response ( ok: true , data: commandJournal. status ( commandId: statusCommandId) )
53+ }
54+
4455 private func executeDispatched( command: Command ) throws -> Response {
4556 if Thread . isMainThread {
4657 return try executeOnMainSafely ( command: command)
@@ -200,14 +211,7 @@ extension RunnerTests {
200211
201212 switch command. command {
202213 case . status:
203- guard
204- let statusCommandId = command. statusCommandId?
205- . trimmingCharacters ( in: . whitespacesAndNewlines) ,
206- !statusCommandId. isEmpty
207- else {
208- return Response ( ok: false , error: ErrorPayload ( message: " status requires statusCommandId " ) )
209- }
210- return Response ( ok: true , data: commandJournal. status ( commandId: statusCommandId) )
214+ return executeStatus ( command: command)
211215 case . shutdown:
212216 stopRecordingIfNeeded ( )
213217 return Response ( ok: true , data: DataPayload ( message: " shutdown " ) )
0 commit comments