Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.
/ Spawn Public archive
forked from aciidgh/Spawn

Easily spawn new processes using Swift

Notifications You must be signed in to change notification settings

jakeheis/Spawn

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Easily spawn new processes using Swift

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 100.0%