{"id":13719296,"url":"https://github.com/RxSwiftCommunity/RxTask","last_synced_at":"2025-05-07T11:31:26.946Z","repository":{"id":78527022,"uuid":"82123108","full_name":"RxSwiftCommunity/RxTask","owner":"RxSwiftCommunity","description":"An RxSwift implementation of a command line runner.","archived":false,"fork":false,"pushed_at":"2017-02-28T16:37:47.000Z","size":567,"stargazers_count":15,"open_issues_count":0,"forks_count":3,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-04-29T06:32:18.369Z","etag":null,"topics":["command-line","macos","runner","rxswift","rxswift-extensions","swift"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RxSwiftCommunity.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-02-16T00:59:08.000Z","updated_at":"2024-03-04T04:10:05.000Z","dependencies_parsed_at":"2023-05-21T09:45:35.726Z","dependency_job_id":null,"html_url":"https://github.com/RxSwiftCommunity/RxTask","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RxSwiftCommunity%2FRxTask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RxSwiftCommunity%2FRxTask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RxSwiftCommunity%2FRxTask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RxSwiftCommunity%2FRxTask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RxSwiftCommunity","download_url":"https://codeload.github.com/RxSwiftCommunity/RxTask/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252868824,"owners_count":21816923,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command-line","macos","runner","rxswift","rxswift-extensions","swift"],"created_at":"2024-08-03T01:00:45.902Z","updated_at":"2025-05-07T11:31:26.502Z","avatar_url":"https://github.com/RxSwiftCommunity.png","language":"Swift","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"# RxTask\nAn [RxSwift](https://github.com/ReactiveX/RxSwift) implementation of a command line task runner.\n\n[![GitHub release](https://img.shields.io/github/release/RxSwiftCommunity/RxTask.svg)]()\n[![Build Status](https://travis-ci.org/RxSwiftCommunity/RxTask.svg?branch=master)](https://travis-ci.org/RxSwiftCommunity/RxTask)\n[![codecov](https://codecov.io/gh/RxSwiftCommunity/RxTask/branch/master/graph/badge.svg)](https://codecov.io/gh/RxSwiftCommunity/RxTask)\n[![docs](https://cdn.rawgit.com/RxSwiftCommunity/RxTask/master/docs/badge.svg)](https://RxSwiftCommunity.github.io/RxTask/)\n[![carthage compatible](https://img.shields.io/badge/carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![swift package manager compatible](https://img.shields.io/badge/spm-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager)\n![platform macOS](https://img.shields.io/badge/platform-macOS-blue.svg)\n[![language swift 3.0](https://img.shields.io/badge/language-Swift%203.0-orange.svg)](https://swift.org)\n\n## Linux Compatibility\n\nCurrently, RxTask does not support Linux. RxTask relies on some functionality\nin `Foundation` that is currently not available in the Linux port. This will be\nre-evaluated after the Swift 3.1 release. PRs in this area are quite welcome! 👍\n\n## Installation\n\n### Carthage\n\n```shell\ngithub \"RxSwiftCommunity/RxTask\"\n```\n\n### SPM\n\n```swift\nimport PackageDescription\n\nlet package = Package(\n    name: \"YOUR_PROJECT_NAME\",\n    targets: [],\n    dependencies: [\n        .Package(url: \"https://github.com/RxSwiftCommunity/RxSwift.git\", majorVersion: 0)\n    ]\n)\n```\n\n## Usage\n\n### Create A Task\n\nCreating a task is as simple as providing a `launchPath` to the executable.\n\n```swift\nlet task = Task(launchPath: \"/bin/ls\")\n```\n\nOptionally, you can provide `arguments`, a `workingDirectory`, and an\n`environment`.\n\n```swift\nlet task = Task(launchPath: \"/bin/echo\", arguments: [\"$MESSAGE\"], environment: [\"MESSAGE\": \"Hello World!\"])\n```\n\n### Launch A Task\n\n`Task`s can be launched with the `launch()` method. This produces a\nself-contained process. This means the same task can be `launch()`ed multiple\ntimes producing separate processes.\n\n#### TaskEvent\n\nThe output of `launch()` is a `Observable\u003cTaskEvent\u003e`. `TaskEvent` is an `enum`\nthat is used to report significant events in the task lifetime. The possible\nevents are:\n\n* `launch(command: String)`\n* `stdOut(Data)`\n* `stdErr(Data)`\n* `exit(statusCode: Int)`\n\n**Note:** Currently an event is only considered successful if it exits with a\n`statusCode` of 0. Other exit statuses will be considered a `TaskError`.\n\n#### StdIn\n\nIf you create a task that expects input, you can provide an `Observable\u003cData\u003e`\nfor `stdin` when you are `launch()`ing the `Task`. Data will be written to\n`stdin` as soon as it is emitted by the `Observable`.\n\n#### Filtering TaskEvents\n\nIf you are only concerned with whether a `Task` has completed successfully, you\ncan use the built-in operator `justExitStatus()`.\n\n```swift\nTask(launchPath: \"/bin/ls\").launch()\n    .justExitStatus()\n    .subscribe(onNext: { exitStatus in /* ... */ })\n    .disposed(by: disposeBag)\n```\n\nAlternatively, if you are only interested in the output of a `Task`, you can use\nthe operator `justOutput()`. *This will send the output of both `stdout` and\n`stderr`*.\n\n```swift\nTask(launchPath: \"/bin/ls\").launch()\n    .justOutput()\n    .subscribe(onNext: { output in /* ... */ })\n    .disposed(by: disposeBag)\n```\n\n#### TaskError\n\n`TaskError` is an `Error` that will be emitted under the following situations:\n\n* `uncaughtSignal`: The `Task` terminated with an uncaught signal (e.g. `SIGINT`).\n* `exit(statusCode: Int)`: The `Task` exited with a non-zero exit code.\n\n## API Reference\n\nFull docs can be found [here](https://RxSwiftCommunity.github.io/RxTask/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRxSwiftCommunity%2FRxTask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRxSwiftCommunity%2FRxTask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRxSwiftCommunity%2FRxTask/lists"}