File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -800,7 +800,7 @@ open class Process: NSObject {
800
800
// nil or NullDevice map to /dev/null
801
801
case let handle as FileHandle where handle === FileHandle . _nulldeviceFileHandle: fallthrough
802
802
case . none:
803
- adddup2 [ STDIN_FILENO ] = try devNullFd ( )
803
+ adddup2 [ STDOUT_FILENO ] = try devNullFd ( )
804
804
805
805
// No need to dup stdout to stdout
806
806
case let handle as FileHandle where handle === FileHandle . _stdoutFileHandle: break
@@ -819,7 +819,7 @@ open class Process: NSObject {
819
819
// nil or NullDevice map to /dev/null
820
820
case let handle as FileHandle where handle === FileHandle . _nulldeviceFileHandle: fallthrough
821
821
case . none:
822
- adddup2 [ STDIN_FILENO ] = try devNullFd ( )
822
+ adddup2 [ STDERR_FILENO ] = try devNullFd ( )
823
823
824
824
// No need to dup stderr to stderr
825
825
case let handle as FileHandle where handle === FileHandle . _stderrFileHandle: break
Original file line number Diff line number Diff line change @@ -80,8 +80,15 @@ class TestProcess : XCTestCase {
80
80
81
81
let inputPipe = Pipe ( )
82
82
process. standardInput = inputPipe
83
+ process. standardError = FileHandle . nullDevice
83
84
try process. run ( )
84
- inputPipe. fileHandleForWriting. write ( " Hello, 🐶. \n " . data ( using: . utf8) !)
85
+ let msg = try XCTUnwrap ( " Hello, 🐶. \n " . data ( using: . utf8) )
86
+ do {
87
+ try inputPipe. fileHandleForWriting. write ( contentsOf: msg)
88
+ } catch {
89
+ XCTFail ( " Cant write to pipe: \( error) " )
90
+ return
91
+ }
85
92
86
93
// Close the input pipe to send EOF to cat.
87
94
inputPipe. fileHandleForWriting. closeFile ( )
You can’t perform that action at this time.
0 commit comments