 		if let input = standardInput {
 			switch Pipe.create(queue, group) {
 			case let .Success(pipe):
-				task.standardInput = pipe.readHandle
+				rawTask.standardInput = pipe.readHandle
 
 				stdinProducer = pipe.writeDataFromProducer(input).on(started: {
 					close(pipe.readFD)

						))
					}

					task.standardOutput = stdoutPipe.writeHandle
					task.standardError = stderrPipe.writeHandle

					dispatch_group_enter(group)
					task.terminationHandler = { task in
						let terminationStatus = task.terminationStatus
						if terminationStatus == EXIT_SUCCESS {
							// Wait for stderr to finish, then pass

/// Launches a new shell task.
///
/// - Parameters:
///   - task:          The task to launch.
///   - standardInput: Data to stream to standard input of the launched process. If nil, stdin will
///                    be inherited from the parent process.
///
/// - Returns: A producer that will launch the task when started, then send
/// `TaskEvent`s as execution proceeds.
public func launchTask(task: Task, standardInput: SignalProducer<NSData, NoError>? = nil) -> SignalProducer<TaskEvent<NSData>, TaskError> {
	return SignalProducer { observer, disposable in
		let queue = dispatch_queue_create(task.description, DISPATCH_QUEUE_SERIAL)
		let group = Task.group

		let rawTask = NSTask()
		rawTask.launchPath = task.launchPath
		rawTask.arguments = task.arguments

		if let cwd = task.workingDirectoryPath {
			rawTask.currentDirectoryPath = cwd
		}

		if let env = task.environment {
			rawTask.environment = env
		}

		var stdinProducer: SignalProducer<(), TaskError> = .empty
