nsomar/Swiftline

Run command stuck

avnerbarr opened this issue · 5 comments

I'm running in it seems to not do anything (it is a long running command but it seems to never finish)

If I run the command from the command line terminal it does complete

Is there a way to continually output the stdout (Not wait for the result)

let archiveCommand = "some command to run"
let res = run(archiveCommand) // never completing through my script

I think that this was solved with #25
Could you please give it a try again and let me know :)?

I will close this, but please do reopen it if it persits

I just ran into this same issue using master. For me, it was caused by ffmpeg thinking there was more input comping through stdin. I've found two possible solutions.

Run my script and close stdin with

myScript <&-

or in ActualTaskExecutor execute add

task.standardInput = FileHandle.nullDevice

@CraigSiemens @avnerbarr I did refactor the process execution functionality in SwiftLine and extracted it to another library https://github.com/oarrabi/Runner

This new library is POSIX compliant, it uses posix_spawn under the hood, so it should provide more consistent behaviours.

It is functional, but still in working progress. I would love if you give it a try :)

I finally got around to giving Runner a try and it worked like a charm. Thanks!

@CraigSiemens Thats awesome to hear :) thanks for trying it!