JohnSundell / ShellOut

Easily run shell commands from a Swift script or command line tool
MIT License
870 stars 83 forks source link

Uncaught NSRangeException on waitUntilExit() #68

Open lars06 opened 1 year ago

lars06 commented 1 year ago

Hi everyone. I'm getting a strange error using ShellOut. My app crashes with an NSRangeException on the waitUntilExit() call in the launchBash function (ShellOut:428). This seems to mainly be happening when ShellOut is used in an onAppear or onReceive function using SwiftUI. I am calling ShellOut using syntax let shellOutput = try shellOut(to: command). This seems to work outside of these SwiftUI functions.

*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty NSArray' terminating with uncaught exception of type NSException

Does anyone have an idea what could be going on here? Thanks!