[swift-corelibs-dev] NSTask and try!

james at jelee.co.uk james at jelee.co.uk
Fri May 13 14:25:58 CDT 2016

Following on from a previous discussion with Tests failing on OSX. I 
have been looking into the failures. It seems that one of the earliest 
failures is due to an error from a try! within NSTask.launch(). This 
came in with this commit: 

Going by the docs for Foundation - The launch function apparently 
"Raises an NSInvalidArgumentException if the launch path has not been 
set or is invalid or if it fails to create a process."


My question is, should this be built into the Swift Foundation API? The 
documentation for Swift doesn't state that the launch function throws.

With the test that is failing expecting an error, it feels more Swift-y 
to have any errors throw explicitly, rather than looking at what the 
lower level fills the data with.

But before jumping into doing this, I would rather put it out there and 
see what the community feels about this?



More information about the swift-corelibs-dev mailing list