kareman / SwiftShell

A Swift framework for shell scripting.
https://kareman.github.io/SwiftShell
MIT License
1.03k stars 87 forks source link

Update to Swift 1.2 with workaround for compiler crash #9

Closed beltex closed 9 years ago

beltex commented 9 years ago

Hi @kareman! I saw your comment about the compiler crash, so I took a look! Seems like its the workdirectory property with it’s getter thats causing the compiler crash. I’ve submitted it to the swift-compiler-crashes project.

As a workaround, made workdirectory a struct with static get() and set() functions. All tests pass except for a few in Stream_Tests.swift, which as far as I can tell is unrelated to the workdirectory change, but certainly new as a result of Xcode 6.3.

These hang at runtime:

While these crash at runtime:

kareman commented 9 years ago

@beltex :+1: excellent work, I was dreading having to decipher another segmentation fault 11 compiler crash.

Instead of moving it to a struct I turned workdirectoryinto an extension on NSFilemanager, so you can go File.workdirectory = ... etc. I really want to move tempdirectory there too for consistency but you can't store anything in extensions. I will probably move workdirectory back to the global level when this compiler bug has been fixed.

I disabled the 3 unit tests that crash at runtime until I can find a fix for them. The 2 tests you mention hang at runtime, plus a couple more, only hang when run individually. When running all unit tests at once they work fine. Weird.

beltex commented 9 years ago

np! :)

Nice, yeah thats better than the struct, maintains the original usage style.

Cool, didn't know you could disable them like that! And strange indeed with the hangs.

beltex commented 9 years ago

Good news, looks like this compiler bug has been fixed in Xcode 6.3 Beta 2 :)

No luck on the tests though.

kareman commented 9 years ago

Indeed, thanks for letting me know. I reverted the changes to workdirectory here: f76c81edc2198fdcb048bc0306b8a795697011c6

beltex commented 9 years ago

Nice, np! :)