[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:
https://github.com/apple/swift-corelibs-foundation/commit/4c6f04cfcad3d4b06688558021595d06751fc66a
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."
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSTask_Class/#//apple_ref/occ/instm/NSTask/launch
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?
Cheers
James
More information about the swift-corelibs-dev
mailing list