When 'shelling out' to an async operation, FileHandler.standardOutput can be passed in to see the output in realtime, in the same way as if the command had been executed in the Terminal:
ShellOut currently calls closeFile() on the passed in output handler and error handler. In the case that one of the 'standard' handlers has been passed in, this causes issues such as print() not working.
This PR checks for the 3 standard handlers (input, output, error) and bypasses the call to closeFile(). Any other passed in FileHandler will receive the call.
@JohnSundell let me know how you feel about this solution. It does add a special casing for the 3 handlers (which is a bit weird), but the advantage is that there's no additional complexity to the api, which is probably a good thing for a scripting library!
When 'shelling out' to an async operation,
FileHandler.standardOutput
can be passed in to see the output in realtime, in the same way as if the command had been executed in the Terminal:try shellOut(to: "pod repo update", outputHandle: FileHandle.standardOutput)
ShellOut currently calls
closeFile()
on the passed in output handler and error handler. In the case that one of the 'standard' handlers has been passed in, this causes issues such asprint()
not working.This PR checks for the 3 standard handlers (input, output, error) and bypasses the call to
closeFile()
. Any other passed inFileHandler
will receive the call.@JohnSundell let me know how you feel about this solution. It does add a special casing for the 3 handlers (which is a bit weird), but the advantage is that there's no additional complexity to the api, which is probably a good thing for a scripting library!