Skip to content

Can't run shells in interactive modeΒ #58

@fsateler

Description

@fsateler

Describe the problem

Shells cannot be run with TTY::Command. Keyboard input is not read by the shell.

Steps to reproduce the problem

require 'tty-command'

cmd = TTY::Command.new(pty: true, printer: :quiet)

cmd.run(*ARGV)

Actual behaviour

(slightly edited to remove identifying information)

% bundle exec ruby ./test.rb dash
$ ls
oh no input is going nowhere
^C
$ ^C
$ but ctrl-c is handled?

^C
$ ctrl-d does nothing
^C
$ ^C
$ ^C
$ i have to kill this from another shell
zsh: terminated  bundle exec ruby ./test.rb

% bundle exec ruby ./test.rb bash
bash: cannot set terminal process group (84144): Inappropriate ioctl for device
bash: no job control in this shell
$ input does not go to the shell


ctrl c kills the process
^CTraceback (most recent call last):
	5: from ./test.rb:6:in `<main>'
	4: from ./.bundle/gems/ruby/2.6.0/gems/tty-command-0.9.0/lib/tty/command.rb:104:in `run'
	3: from ./.bundle/gems/ruby/2.6.0/gems/tty-command-0.9.0/lib/tty/command.rb:185:in `execute_command'
	2: from ./.bundle/gems/ruby/2.6.0/gems/tty-command-0.9.0/lib/tty/command/process_runner.rb:48:in `run!'
	1: from ./.bundle/gems/ruby/2.6.0/gems/tty-command-0.9.0/lib/tty/command/process_runner.rb:146:in `read_streams'
./.bundle/gems/ruby/2.6.0/gems/tty-command-0.9.0/lib/tty/command/process_runner.rb:146:in `join': Interrupt

 bundle exec ruby ./test.rb zsh
zsh: substitution failed
zsh: substitution failed
zsh: substitution failed
zsh: substitution failed
zsh: substitution failed
zsh: substitution failed
zsh: substitution failed
zsh: substitution failed
zsh: substitution failed
zsh: substitution failed
zsh: substitution failed
zsh: substitution failed
ls
I can't even get a prompt on zsh
^CTraceback (most recent call last):
	5: from ./test.rb:6:in `<main>'
	4: from ./.bundle/gems/ruby/2.6.0/gems/tty-command-0.9.0/lib/tty/command.rb:104:in `run'
	3: from ./.bundle/gems/ruby/2.6.0/gems/tty-command-0.9.0/lib/tty/command.rb:185:in `execute_command'
	2: from ./.bundle/gems/ruby/2.6.0/gems/tty-command-0.9.0/lib/tty/command/process_runner.rb:48:in `run!'
	1: from ./.bundle/gems/ruby/2.6.0/gems/tty-command-0.9.0/lib/tty/command/process_runner.rb:146:in `read_streams'
./.bundle/gems/ruby/2.6.0/gems/tty-command-0.9.0/lib/tty/command/process_runner.rb:146:in `join': Interrupt

% bundle exec ruby ./test.rb ssh $some_host
<snip MOTD banner>
$ ls
^CTraceback (most recent call last):
	5: from ./test.rb:6:in `<main>'
	4: from ./.bundle/gems/ruby/2.6.0/gems/tty-command-0.9.0/lib/tty/command.rb:104:in `run'
	3: from ./.bundle/gems/ruby/2.6.0/gems/tty-command-0.9.0/lib/tty/command.rb:185:in `execute_command'
	2: from ./.bundle/gems/ruby/2.6.0/gems/tty-command-0.9.0/lib/tty/command/process_runner.rb:48:in `run!'
	1: from ./.bundle/gems/ruby/2.6.0/gems/tty-command-0.9.0/lib/tty/command/process_runner.rb:146:in `read_streams'
./.bundle/gems/ruby/2.6.0/gems/tty-command-0.9.0/lib/tty/command/process_runner.rb:146:in `join': Interrupt

Expected behaviour

A working interactive shell.

Describe your environment

  • OS version: Debian linux sid
  • Ruby version: 2.6.6 and 2.7.1
  • TTY::Command version: 0.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions