-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error on Linux #6
Comments
Thanks for reporting this @niklassaers! I created this PR that should fix the problem 😄 #7 |
@niklassaers It seems like we have some more problems on Linux, all the tests are failing 😅 But if you use the latest released version instead of |
Hi @JohnSundell . Do you know if there's a way around to this readabilityHandler problem on Linux? I know using a NotificationCenter for when data is available to be read is an option. |
@georgealegre Interesting. Can you tell me more about this approach? |
I have the same issue trying to run a program and reading its output as soon as it's available. It's running on a server thanks to the Kitura framework and the idea is to use websockets to broadcast the output. Using readibiltyHandler works for me on Mac but on Ubuntu I have the same issue as you. You can see my code here: GitHub I've read on a bunch of SO posts about using notifications and reacting to those notifications but I can't get it to work. The function that should be receiving those notifications is never called. I assume it's an issue with threads but there isn't much info out there. You can read about the solution I'm talking about here: StackOverflow Maybe you can get it to work and share some insight with me in the process. BTW, thanks for your amazing blog posts. I read them every week. |
@JohnSundell I've found the implementation of FileHandle for Foundation on Linux and it seems these things are still not implemented - FileHandle. Seems we have to wait a while. Using notifications won't work either since |
Thanks for looking into this @georgealegre 👍 Seems like we'll need to revert back to the old technique used before https://github.com/JohnSundell/ShellOut/pull/3/files on Linux. It's also a requirement for using the new version of ShellOut for Marathon, since it also supports Linux - so I'll try to look into this ASAP. |
I've now worked around the error and merged my PR: #7. ShellOut again works on Linux 🎉 Think this is good enough to close this issue for now, and we can revisit this again once the Swift standard library on Linux has caught up with its macOS equivalent in this regard 🙂 What do you think @georgealegre & @niklassaers? |
Seems ok. I'm not sure what your plans are with ShellOut. From the code I've read, it seems like it isn't meant for using input and output streams without closing the pipes or reading asynchronously. I'm not sure if I'm explaining myself correctly. For example, ShellOut wouldn't be able to run |
I would actually love for ShellOut to be able to hand continous/async output, but there's a separate issue for it here: #11. Closing this one for now 😄 Thanks for all your input on this 👍 |
With Swift 3.1.1 on Ubuntu, I get the following error:
Compile Swift Module 'ShellOut' (1 sources)
/var/lib/jenkins/workspace/ShellOut SPM Linux/Sources/ShellOut.swift:96:60: error: cannot assign to property: 'readabilityHandler' is a get-only property
outputPipe.fileHandleForReading.readabilityHandler = stdoutHandler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/var/lib/jenkins/workspace/ShellOut SPM Linux/Sources/ShellOut.swift:100:59: error: cannot assign to property: 'readabilityHandler' is a get-only property
errorPipe.fileHandleForReading.readabilityHandler = stderrHandler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/var/lib/jenkins/workspace/ShellOut SPM Linux/Sources/ShellOut.swift:108:60: error: cannot assign to property: 'readabilityHandler' is a get-only property
outputPipe.fileHandleForReading.readabilityHandler = nil
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/var/lib/jenkins/workspace/ShellOut SPM Linux/Sources/ShellOut.swift:109:59: error: cannot assign to property: 'readabilityHandler' is a get-only property
errorPipe.fileHandleForReading.readabilityHandler = nil
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
:0: error: build had 1 command failures
The text was updated successfully, but these errors were encountered: