blessed icon indicating copy to clipboard operation
blessed copied to clipboard

Executing a command with terminal widget programatically?

Open korenyoni opened this issue 9 years ago • 7 comments

I want to run a command within the terminal widget, and I want to control when it is executed. I tried achieving this through myterm.term.write('somecommand'); with no success. Also I've looked into pty.js and term.js and don't really have any good ideas.

Is there a way to do this?

korenyoni avatar Mar 04 '16 05:03 korenyoni

Not going to close this issue just yet since I'm not sure how reliable this is, but changing the shell variable in the instantiation of the terminal widget, and recreating the terminal each time a different command is desired may suffice.

korenyoni avatar Mar 22 '16 03:03 korenyoni

I am interested in executing command too, any solution?

bogomips avatar May 17 '18 09:05 bogomips

@bogomips it's been 2 years and still no, unfortunately

korenyoni avatar May 17 '18 21:05 korenyoni

As you suggested I changed the shell variable. Right now I am trying blessed-xterm that explicitly supports "spawn".

spawn (shell: String, args: String[], cwd?: String, env?: Object): Void: Spawn/run a command, optionally first terminating a currently running one.

bogomips avatar May 18 '18 12:05 bogomips

@bogomips any luck?

korenyoni avatar May 18 '18 22:05 korenyoni

I created this framework and for writing functional / automation tests of CLI apps. https://github.com/cancerberoSgx/cli-driver/tree/master/packages/cli-driver A similar API than web-driver - consume - waitFor and write. I have success for inquirer and blessed based Apps. Also vim, emacs and even some CLI games. In blessed Apps be careful to strip ansi-strings before asserting against them since its full of them.

cancerberoSgx avatar Apr 11 '19 15:04 cancerberoSgx

@cancerberoSgx I'll check out your repo!

korenyoni avatar Apr 11 '19 16:04 korenyoni