Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lakr233/auxiliaryexecute
A Swift wrapper for system shell over posix_spawn with search path and env support.
https://github.com/lakr233/auxiliaryexecute
Last synced: about 2 months ago
JSON representation
A Swift wrapper for system shell over posix_spawn with search path and env support.
- Host: GitHub
- URL: https://github.com/lakr233/auxiliaryexecute
- Owner: Lakr233
- License: mit
- Created: 2021-12-06T12:43:52.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-16T21:46:07.000Z (10 months ago)
- Last Synced: 2024-05-01T18:42:44.914Z (8 months ago)
- Language: Swift
- Size: 28.3 KB
- Stars: 19
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AuxiliaryExecute
A Swift wrapper for system shell over posix_spawn with search path and env support.
## Usage
```
import AuxiliaryExecuteAuxiliaryExecute.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](./LICENSE).
---
Copyright © 2021 Lakr Aream. All Rights Reserved.