6
6
7
7
import Foundation
8
8
import Dispatch
9
+ import Logging
9
10
10
11
// MARK: - API
11
12
@@ -33,6 +34,7 @@ import Dispatch
33
34
arguments: [ Argument ] = [ ] ,
34
35
at path: String = " . " ,
35
36
process: Process = . init( ) ,
37
+ logger: Logger ? = nil ,
36
38
outputHandle: FileHandle ? = nil ,
37
39
errorHandle: FileHandle ? = nil ,
38
40
environment: [ String : String ] ? = nil ,
@@ -42,6 +44,7 @@ import Dispatch
42
44
43
45
return try process. launchBash (
44
46
with: command,
47
+ logger: logger,
45
48
outputHandle: outputHandle,
46
49
errorHandle: errorHandle,
47
50
environment: environment,
@@ -90,6 +93,7 @@ import Dispatch
90
93
to command: ShellOutCommand ,
91
94
at path: String = " . " ,
92
95
process: Process = . init( ) ,
96
+ logger: Logger ? = nil ,
93
97
outputHandle: FileHandle ? = nil ,
94
98
errorHandle: FileHandle ? = nil ,
95
99
environment: [ String : String ] ? = nil ,
@@ -100,6 +104,7 @@ import Dispatch
100
104
arguments: command. arguments,
101
105
at: path,
102
106
process: process,
107
+ logger: logger,
103
108
outputHandle: outputHandle,
104
109
errorHandle: errorHandle,
105
110
environment: environment,
@@ -435,6 +440,7 @@ extension ShellOutCommand {
435
440
private extension Process {
436
441
@discardableResult func launchBash(
437
442
with command: String ,
443
+ logger: Logger ? = nil ,
438
444
outputHandle: FileHandle ? = nil ,
439
445
errorHandle: FileHandle ? = nil ,
440
446
environment: [ String : String ] ? = nil ,
@@ -493,7 +499,9 @@ private extension Process {
493
499
try self . run ( )
494
500
self . waitUntilExit ( )
495
501
496
- _ = outputGroup. wait ( timeout: . now( ) + eofTimeout)
502
+ if outputGroup. wait ( timeout: . now( ) + eofTimeout) == . timedOut {
503
+ logger? . warning ( " ShellOut.launchBash: Timed out waiting for EOF! (command: \( command) ) " )
504
+ }
497
505
498
506
// We know as of this point that either all blocks have been submitted to the
499
507
// queue already, or we've reached our wait timeout.
0 commit comments