JohnSundell / ShellOut

Easily run shell commands from a Swift script or command line tool
MIT License
872 stars 85 forks source link

Closes Filehandle.standardOutput #22

Closed SteveBarnegren closed 6 years ago

SteveBarnegren commented 6 years ago

Hi John,

I'm not familiar with the FileHandle api and usage, so forgive me if I'm using it incorrectly here!

I'm trying to 'shell out' to a command that prints asynchronously, and I'd like to see that output in realtime, just as if I'd called it from Terminal.

I can pass in FileHandle.standardOutput to achieve this, like so:

try shellOut(to: "some command", outputHandle: FileHandle.standardOutput)

It works great, but I can't see any output, for instance from print() after ShellOut returns.

It looks like this is because ShellOut calls outputHandle?.closeFile()

Is there a currently supported way to achieve this? If not, would you accept a PR to add this functionality?

JohnSundell commented 6 years ago

Hi @SteveBarnegren! 👋

Async output it not yet supported by ShellOut, but I'd love to see it supported - I would totally accept a PR that adds it 👍 Hope you don't mind, but I'll close this issue as a duplicate, since we already have an issue for async output here: https://github.com/JohnSundell/ShellOut/issues/11. Let me know there if this is something that you'd like to work on 🙂