Skip to content

Commit 4bffd2f

Browse files
committed
Work around type inference failure for flatMap
1 parent 697d4af commit 4bffd2f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ReactiveTask/Task.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,12 @@ public func launchTask(taskDescription: TaskDescription, standardOutput: SinkOf<
267267
}
268268
}
269269

270-
SignalProducer(result: Pipe.create())
271-
|> zipWith(SignalProducer(result: Pipe.create()))
272-
|> flatMap(.Merge) { stdoutPipe, stderrPipe -> SignalProducer<NSData, ReactiveTaskError> in
270+
let pipes = SignalProducer(result: Pipe.create()) |> zipWith(SignalProducer(result: Pipe.create()))
271+
272+
// The Swift compiler can't figure out that we're applying this to
273+
// a Producer when using |> :(
274+
flatMap(.Merge,
275+
{ stdoutPipe, stderrPipe -> SignalProducer<NSData, ReactiveTaskError> in
273276
let stdoutProducer = aggregateDataReadFromPipe(stdoutPipe, standardOutput)
274277
let stderrProducer = aggregateDataReadFromPipe(stderrPipe, standardError)
275278

@@ -315,7 +318,7 @@ public func launchTask(taskDescription: TaskDescription, standardOutput: SinkOf<
315318
return .failure(.ShellTaskFailed(exitCode: terminationStatus, standardError: errorString))
316319
}
317320
}
318-
}
321+
})(producer: pipes)
319322
|> startWithSignal { signal, taskDisposable in
320323
disposable.addDisposable(taskDisposable)
321324
signal.observe(observer)

0 commit comments

Comments
 (0)