@@ -234,29 +234,6 @@ internal func _make_posix_spawn_file_actions_t()
234
234
#endif
235
235
#endif
236
236
237
- internal func _readAll( _ fd: CInt ) -> String {
238
- var buffer = [ UInt8] ( repeating: 0 , count: 1024 )
239
- var usedBytes = 0
240
- while true {
241
- let readResult : ssize_t = buffer. withUnsafeMutableBufferPointer {
242
- ( buffer) in
243
- let ptr = UnsafeMutablePointer < Void > ( buffer. baseAddress! + usedBytes)
244
- return read ( fd, ptr, size_t ( buffer. count - usedBytes) )
245
- }
246
- if readResult > 0 {
247
- usedBytes += readResult
248
- continue
249
- }
250
- if readResult == 0 {
251
- break
252
- }
253
- preconditionFailure ( " read() failed " )
254
- }
255
- return String . _fromCodeUnitSequenceWithRepair (
256
- UTF8 . self, input: buffer [ 0 ..< usedBytes] ) . 0
257
- }
258
-
259
-
260
237
internal func _signalToString( _ signal: Int ) -> String {
261
238
switch CInt ( signal) {
262
239
case SIGILL: return " SIGILL "
@@ -298,26 +275,6 @@ public func posixWaitpid(_ pid: pid_t) -> ProcessTerminationStatus {
298
275
preconditionFailure ( " did not understand what happened to child process " )
299
276
}
300
277
301
- public func runChild( _ args: [ String ] )
302
- -> ( stdout: String , stderr: String , status: ProcessTerminationStatus ) {
303
- let ( pid, _, stdoutFD, stderrFD) = spawnChild ( args)
304
-
305
- // FIXME: reading stdout and stderr sequentially can block. Should use
306
- // select(). This is not so simple to implement because of:
307
- // <rdar://problem/17828358> Darwin module is missing fd_set-related macros
308
- let stdout = _readAll ( stdoutFD)
309
- let stderr = _readAll ( stderrFD)
310
-
311
- if close ( stdoutFD) != 0 {
312
- preconditionFailure ( " close() failed " )
313
- }
314
- if close ( stderrFD) != 0 {
315
- preconditionFailure ( " close() failed " )
316
- }
317
- let status = posixWaitpid ( pid)
318
- return ( stdout, stderr, status)
319
- }
320
-
321
278
#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
322
279
@_silgen_name ( " _NSGetEnviron " )
323
280
func _NSGetEnviron( ) -> UnsafeMutablePointer < UnsafeMutablePointer < UnsafeMutablePointer < CChar > ? > >
0 commit comments