SwiftShell icon indicating copy to clipboard operation
SwiftShell copied to clipboard

How to execute an ncurses-based command?

Open dannys42 opened this issue 4 years ago • 2 comments

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.

dannys42 avatar Nov 24 '21 01:11 dannys42

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.

kareman avatar Nov 24 '21 07:11 kareman

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?

honghaoz avatar May 01 '22 07:05 honghaoz