Skip to content

Commit

Permalink
Work around type inference failure for flatMap
Browse files Browse the repository at this point in the history
  • Loading branch information
jspahrsummers committed May 6, 2015
1 parent 697d4af commit 4bffd2f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ReactiveTask/Task.swift
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,12 @@ public func launchTask(taskDescription: TaskDescription, standardOutput: SinkOf<
}
}

SignalProducer(result: Pipe.create())
|> zipWith(SignalProducer(result: Pipe.create()))
|> flatMap(.Merge) { stdoutPipe, stderrPipe -> SignalProducer<NSData, ReactiveTaskError> in
let pipes = SignalProducer(result: Pipe.create()) |> zipWith(SignalProducer(result: Pipe.create()))

// The Swift compiler can't figure out that we're applying this to
// a Producer when using |> :(
flatMap(.Merge,
{ stdoutPipe, stderrPipe -> SignalProducer<NSData, ReactiveTaskError> in
let stdoutProducer = aggregateDataReadFromPipe(stdoutPipe, standardOutput)
let stderrProducer = aggregateDataReadFromPipe(stderrPipe, standardError)

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

0 comments on commit 4bffd2f

Please sign in to comment.