For me, this works in compiled apps but dies in playgrounds. What about you?
public struct StderrStream : OutputStreamType { public func write(string : String) { fputs(string, stderr) } } var myErrStream = StderrStream() print("TESTING", &myErrStream)
Thanks for letting me know.
7 Comments
It works in 6.4, always fails in 7.0 beta2 “Communication with the playground service was interrupted unexpectedly.”
What do you mean by that it “dies”?
In Xcode 6.4 (6E36b), the following shows:
http://i1344.photobucket.com/albums/p656/cerberusss/Screen%20Shot%202015-07-02%20at%2021.49.11_zpsaevta0uk.png
Better link of Playground: https://www.vankuik.nl//download/temp_picture
No crash when running it in an otherwise empty iOS playground for me either. Oddly I don’t have the same version of Xcode though. I have `version 6.4 (6E35b)`
On the commandline, it works:
https://www.vankuik.nl//download/temp_picture2
This crashes for me in OS X Yosemite, with a recently updated (January 2016) XCode. Repro case and error stack trace here: https://gist.github.com/andrewgho/e28e6f6e33d4e0caa7a4
Aha! This fixed the crash for me: print(“TESTING”, toStream: &myErrStream)
According to http://stackoverflow.com/a/25226794 this change went in late last year. You may wish to update some of your past examples (which, by the way, are all excellent! Thanks for writing this blog!).