You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The SubprocessError type nicely encapsulates the errors that come from the (deprecated) Shell code. However, when the process being called exits with a non-zero exit code and output no other info to stdout or stderr, the description of the error is empty for the calling code.
Example code:
do{
_ =tryShell(["/usr/bin/false"]).exec()}catch{os_log("Error description was: '\(error.localizedDescription)'")
if let exitError = error as?SubprocessError,
case .exitedWithNonZeroStatus(let exitCode,let text)= exitError {os_log("Exit code was: \(exitCode); text was '\(text)'")}}
Actual output:
Error description was: ''
Exit code was: 1; text was ''
Expected output (something like this):
Error description was: 'Process exited with code 1'
Exit code was: 1; text was ''
The
SubprocessError
type nicely encapsulates the errors that come from the (deprecated)Shell
code. However, when the process being called exits with a non-zero exit code and output no other info to stdout or stderr, the description of the error is empty for the calling code.Example code:
Actual output:
Expected output (something like this):
Current usages of . exitedWithNonZeroStatus:
Subprocess/Sources/Subprocess/Shell.swift
Line 110 in 5568e42
Subprocess/Sources/Subprocess/Shell.swift
Line 154 in 5568e42
Current code that converts the error to text:
Subprocess/Sources/Subprocess/Errors.swift
Line 55 in 5568e42
The text was updated successfully, but these errors were encountered: