Latest 0.16.0
Homepage https://github.com/Carthage/ReactiveTask
License MIT
Platforms osx 10.9
Dependencies Result, ReactiveSwift

ReactiveTask is a Swift framework for launching shell tasks (processes), built using ReactiveSwift.

let strings = [ "foon", "barn", "buzzn", "fuzzn" ]
let input = SignalProducer<Data, NoError>(values: strings.map { $0.data(using: .utf8)! })
let task = Task("/usr/bin/sort")

// Run the task, ignoring the output, and do something with the final result.
let result: Result<String, TaskError>? = task.launch(standardInput: input)
    .ignoreTaskData()
    .map { String(data: $0, encoding: .utf8) }
    .ignoreNil()
    .single()
print("Output of `(task)`: (result?.value ?? "")")

// Start the task and print all the events, which includes all the output
// that was received.
task.launch(standardInput: input)
    .flatMapTaskEvents(.concat) { data in
        return SignalProducer(value: String(data: data, encoding: .utf8))
    }
    .startWithNext { (event: TaskEvent) in
        switch event {
        case let .launch(task):
            print("launched task: (task)")

        case let .standardError(data):
            print("stderr: (data)")

        case let .standardOutput(data):
            print("stdout: (data)")

        case let .success(string):
            print("value: (string ?? "")")
        }
    }

For examples of how to use ReactiveTask, see the Xcode and Git integration code from the CarthageKit framework.

License

ReactiveTask is released under the MIT license.

Latest podspec

{
    "name": "ReactiveTask",
    "version": "0.16.0",
    "summary": "Swift framework for launching shell tasks",
    "description": "ReactiveTask is a Swift framework for launching shell tasks (processes), built using ReactiveSwift.",
    "homepage": "https://github.com/Carthage/ReactiveTask",
    "license": {
        "type": "MIT",
        "file": "LICENSE.md"
    },
    "authors": "Carthage",
    "platforms": {
        "osx": "10.9"
    },
    "source": {
        "git": "https://github.com/Carthage/ReactiveTask.git",
        "tag": "0.16.0"
    },
    "source_files": "Sources/*.{swift}",
    "dependencies": {
        "Result": [
            "~> 4.1"
        ],
        "ReactiveSwift": [
            "~> 5.0"
        ]
    },
    "pod_target_xcconfig": {
        "OTHER_SWIFT_FLAGS[config=Release]": "$(inherited) -suppress-warnings"
    },
    "cocoapods_version": ">= 1.4.0",
    "swift_versions": "4.2",
    "swift_version": "4.2"
}

Pin It on Pinterest

Share This