Swiftpack.co - Package - Carthage/ReactiveTask

ReactiveTask

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

let strings = [ "foo\n", "bar\n", "buzz\n", "fuzz\n" ]
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.

Github

link
Stars: 131

Used By

Total: 0

Releases

0.16.0 - 2019-06-13 12:44:35

Breaking

  • Updated to ReactiveSwift 5 (#112). It requires Swift 4.2 or above. Thanks @mattprowse!

Added

  • CocoaPods support (#111). Thanks @pepibumur!

Improved

  • Child processes should now terminate when the parent exits (#110). Thanks @ikesyo!

Fixed

  • Compilation on Linux (#109). Thanks @RahulKatariya!

Thank you to @mdiep and @ikesyo for reviewing pull requests.

0.15.0 - 2018-08-07 15:41:47

Breaking

  • Update ReactiveSwift to 4.0 (#107). So ReactiveTask now requires Xcode 9.4 (Swift 4.1). Thanks @ikesyo!

Improved

  • Utilize conditional conformances and synthesizing Equatable conformance (#108). Thanks @ikesyo!

Thank you to @blender and @mdiep for reviewing pull requests.

0.14.0 - 2017-11-23 07:17:51

Breaking

  • ReactiveTask requires Xcode 9 (Swift 4) now (#100, #102, #103). Thanks @ikesyo!

Improved

  • Escape NULL terminator in strings with correct glyph (#104). Thanks @iv-mexx!
  • Update ReactiveSwift to 3.0 (#106). Thanks @ikesyo!

Thank you to @mdiep, @NachoSoto and @ikesyo for reviewing pull requests.

0.13.0 - 2017-07-25 04:24:32

Improved

  • Update ReactiveSwift to 2.0 (#97, #98, #99). Thanks @ikesyo!

Thank you to @mdiep for reviewing pull requests.

0.12.0 - 2017-07-04 13:23:25

Breaking

  • ReactiveTask requires Xcode 8.3 (Swift 3.1) now (#94). Thanks @ikesyo!

Improved

  • The working directory is added to Task.description if set (#95). Thanks @ikesyo!

Thank you to @mdiep for reviewing pull requests.

0.11.1 - 2017-03-28 10:33:46

Improved

  • Update dependencies (#89, #91, #92). Thanks @ikesyo!
  • Swift Package Manager interoperability with other dependencies (#90). Thanks @ikesyo!
  • Task.description now correctly escape whitespace characters included in its arguments instead of quoting the entire argument (#93). Thanks @ikesyo!

Thank you to @mdiep and @NachoSoto for reviewing pull requests.

0.11 - 2017-02-01 13:42:39

Added

  • Swift 3 support (#62, #72, #80). Thanks @mattprowse and @ikesyo!
  • Support for Swift Package Manager (#88). Thanks @ikesyo!

Improved

  • launchTask is now Task.launch (#76). Thanks @ikesyo!

Thank you to @ikesyo and @mdiep for improvements to the codebase. Thank you to @mdiep, @NachoSoto, and @ikesyo for reviewing pull requests.

0.10.3 - 2016-07-20 23:54:41

Added

  • Support for Swift 2.3 and Xcode 8 (#69). Thanks @ikesyo!

Thank you to @mdiep for reviewing pull requests!

0.10.2 - 2016-07-18 04:37:19

Fixed

  • TaskEvent.StandardOutput's are accidentally sent for standard error data (#67). Thanks @ikesyo!

Thank you to @mdiep for reviewing pull requests!

0.10.1 - 2016-07-16 02:02:11

Fixed

  • Arguments in Task.description those are containing whitespace characters are now escaped (#63). Thanks @ikesyo!

Thank you to @mdiep and @NachoSoto for reviewing pull requests!

0.10.0 - 2016-04-03 06:51:54

This release drops support for Swift 2.1.

Added

  • Support for Swift 2.2 (#56). Thanks @mattprowse and @ikesyo!

Improved

  • BREAKING CHANGE :warning: TaskError now reports which task failed (#53). Thanks @younata!
  • TaskError is now Equatable (#54, #55). Thanks @younata and @ikesyo!

Thank you to @mdiep, @NachoSoto and @ikesyo for reviewing pull requests!

0.9.1 - 2016-01-29 20:15:37

Improved

  • ReactiveCocoa has been upgraded to 4.0! (#51) Thanks @ikesyo!

Thank you to @mdiep and @NachoSoto for reviewing pull requests!

0.9 - 2015-12-19 06:03:59

Improved

  • TaskDescription has been renamed to Task, ReactiveTaskError has been renamed to TaskError, and some of the related API has been simplified (#39). Thanks @mdiep!
  • A Launch case has been added to TaskEvent (#39, #42). Thanks @mdiep and @ikesyo!
  • A code sample has been added to the README (#40). Thanks @mdiep!
  • Project settings have been updated for Xcode 7 (#45). Thanks @mdiep!
  • ReactiveCocoa has been upgraded to v4.0-RC1, which contains an important bug fix (#46). Thanks @NachoSoto!

Thank you to @mdiep for improvements to the codebase! Thank you to @ikesyo for reviewing pull requests!

0.8.0-beta.2 - 2015-12-02 12:39:15

This release is meant for use with Xcode 7.1 and Swift 2.1.

Improved

Thank you to @NachoSoto and @mdiep for reviewing PRs!

0.8.0-beta.1 - 2015-10-30 01:27:31

This release is meant for use with Xcode 7.1 and Swift 2.1.

Improved

Thank you to @mdiep and @NachoSoto for reviewing PRs!

0.7 - 2015-09-15 01:41:58

  • [fixed] Fix a heap overflow detected by Address Sanitizer (#33, thanks @mattprowse!)
  • [improved] Updates to ReactiveCocoa v3.0 final (#34, thanks @ikesyo!)

0.7-beta.3 - 2015-07-23 15:23:10

  • [fixed] Return earlier on a pipe creation failure in launchTask() (#27, thanks @jspahrsummers for the review!)
  • [fixed] Updates to ReactiveCocoa v3.0-RC.1, restores Carthage support. The swift-development was merged and removed. (#30, #32, thanks @AndrewSB and @robrix!)

0.7-beta.2 - 2015-06-06 05:16:42

  • Tracks ReactiveCocoa on the swift-development branch directly, instead of using a tag.

0.7b1: Full Stop. - 2015-06-05 13:03:57

  • [new] Callers can synchronously wait for all tasks to finish.

0.6: Onef Ootin Fronto Fthe Other - 2015-05-19 23:20:10

Updates to ReactiveCocoa v3.0-beta.5.

0.5.1: One Foot in Front of the Other - 2015-05-17 18:49:43

  • [fixed] Pipe reading/writing occurs on named serial queues instead of the global queue.

0.5: The Result Inside Me - 2015-05-06 16:48:33

0.4.2: The Hills Have Eyes with the Sound of RAC - 2015-04-13 06:02:57

Updates to ReactiveCocoa v3.0-alpha.4 (a3af414033a7722ab86097094b82bb1c5ee205a4).

0.4.1: The Hills Are Alive with the Sound of RAC - 2015-03-21 18:17:19

Updates to ReactiveCocoa v3.0-alpha.3 (ce7b2b19af2466ef4c7f2ef71c10df35c0e45154).

0.4: Network - 2015-03-17 04:09:09

Upgrades to Swift 1.2b3 (#12).

0.3: Gene Parmesan - 2015-03-06 07:03:24

Upgrades RAC and other dependencies (#9), and fixes some project configuration issues (#10, #11).

0.2: Does Anyone Even Read These - 2015-02-14 00:22:49

Configuration changes, and upgrading the repository to the Carthage 0.4+ file structure.

0.1 - 2014-12-01 22:49:18

Initial release