Swiftpack.co - Co2333/AuxiliaryExecute as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by Co2333.
Co2333/AuxiliaryExecute 1.1.1
A Swift wrapper for system shell over posix_spawn with search path and env support.
⭐️ 2
🕓 1 week ago
.package(url: "https://github.com/Co2333/AuxiliaryExecute.git", from: "1.1.1")

AuxiliaryExecute

A Swift wrapper for system shell over posix_spawn with search path and env support.

Usage

import AuxiliaryExecute

AuxiliaryExecute.local.bash(command: "echo nya")

Customization & Defaults

The source for this package is well explained in details along with comments. Feel free looking for them.

// automatically search for binary within env PATH
let result = AuxiliaryExecute.local.shell(
    command: "bash",
    args: ["-c", "echo $mua"],
    environment: ["mua": "nya"],
    timeout: 0
) { stdout in
    print(stdout)
} stderrBlock: { stderr in
    print(stderr)
}

// or call with binary's full path
func spawn(
    command: String,
    args: [String] = [],
    environment: [String: String] = [:],
    timeout: Double = 0,
    stdoutBlock: ((String) -> Void)? = nil,
    stderrBlock: ((String) -> Void)? = nil
)

// for customize option for shell
func appendSearchPath(with value: String)
func updateExtraSearchPath(with block: (inout [String]) -> Void)
func updateOverwriteTable(with block: (inout [String: String?]) -> Void)

License

AuxiliaryExecute is licensed under MIT.


Copyright © 2021 Lakr Aream. All Rights Reserved.

GitHub

link
Stars: 2
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

Async Await + Dispatch Source Implementation
1 week ago

Fixed bugs on mishandling waitpid results.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics