Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Latest commit

 

History

History
35 lines (24 loc) · 1017 Bytes

README.md

File metadata and controls

35 lines (24 loc) · 1017 Bytes

AsyncCommand

A structured concurrency wrapper for running external processes.

Usage

let homeURL = FileManager.default.homeDirectoryForCurrentUser
let path = homeURL.path + "/Desktop"

let ffmpeg = Command(name: "ffmpeg",
                     command: "/usr/local/bin/ffmpeg",
                     arguments: [
                        "-y",
                        "-i", "\(path)/big_buck_bunny_720.mov",
                        "-c:v", "hevc_videotoolbox",
                        "\(path)/big_buck_bunny_h265.mp4"
                     ],
                    verbose: true)
                    
try await ffmpeg.run()

Error Phrases

Sometimes a script or tool might not actually exit with non-zero in the case of an error. The errorPhrases parameter takes a list of strings which are used to indicate that the command has failed.
The output of the command is searched for these phrases, setting the status to .error if there's a match, regardless of what the command returns.