kareman / SwiftShell

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

How to execute an ncurses-based command? #104

Open dannys42 opened 2 years ago

dannys42 commented 2 years ago

When executing an ncurses-based (such as vim), the output does not appear to update correctly.

For example:

try runAndPrint("/usr/bin/vim")

I do not see the vim UI at all. When I hit Ctrl-C, I see a flash in the terminal. So this implies that the text controls were sent but perhaps are being buffered. I looked through the code but I don't see an obvious way to control the stdout buffer size.

As a separate issue, it would be nice if there was a way to pass-thru ctrl-c and other job control keys to the executing process.

kareman commented 2 years ago

Hi, SwiftShell does not support interacting with running processes, other than launching them and getting their output.

Except if you run a command runAsync you can send commands .stop, .interrupt and .suspend . .stop is normally the same as Ctrl-C I believe.

  1. nov. 2021 kl. 02:41 skrev Danny Sung @.***>:

 When executing an ncurses-based (such as vim), the output does not appear to update correctly.

For example:

try runAndPrint("/usr/bin/vim") I do not see the vim UI at all. When I hit Ctrl-C, I see a flash in the terminal. So this implies that the text controls were sent but perhaps are being buffered. I looked through the code but I don't see an obvious way to control the stdout buffer size.

As a separate issue, it would be nice if there was a way to pass-thru ctrl-c and other job control keys to the executing process.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

honghaoz commented 2 years ago

I have limited knowledge of shell command. Is program such as less is this type of command that you can't interact via SwiftShell?

My problem is I'd like to run following command:

try? SwiftShell.runAndPrint("/usr/local/bin/git", "log")

just like you run git log in Terminal.app so that you can scroll and type q to quit.

Any hints on how to support this feature?