Spawn

0.0.3

Easily spawn new processes using Swift
aciidgh/Spawn

What's New

Update to latest syntax

2016-08-12T20:03:40Z

Spawn

  • Note: Works on macOS and Linux.

  • Spawn runs new processes using posix_spawn and reads output (and stderr stream) on a different thread so the calling thread is never blocked.

How to use?

Just pass the arguments to execute. For example:

import Spawn

do {
    let spawn = try Spawn(args: ["/bin/sh", "-c", "ls", "."]) { str in
        print(str)
    }
} catch {
    print("error: \(error)")
}

How to install?

Swift Package Manager:

  • Add dependency in Package.swift
import PackageDescription

let package = Package(
    name: "MyPackage",

    dependencies: [
        .Package(url: "https://github.com/aciidb0mb3r/Spawn", majorVersion: 0)
    ]
)

License

MIT

Description

  • Swift Tools 3.1.0
View More Packages from this Author

Dependencies

  • None
Last updated: Fri Oct 18 2024 03:00:30 GMT-0900 (Hawaii-Aleutian Daylight Time)