Put the following file on a server:
1.sh:
#!/usr/bin/env bash
read -p 'Enter your name: ' name
echo Hello, $name
$ ssh user@domain -t ./1.sh
Enter your name: name
Hello, name
Connection to domain closed.
$ ruby -e "exec('ssh user@domain -t ./1.sh')"
Enter your name: name
Hello, name
Connection to domain closed.
1.rb:
script = ["ssh", "user@domain", "-tt", './1.sh']
status = Open4.popen4(*script) do |pid, _stdin, stdout, stderr|
trap('INT') { Process.kill 'KILL', pid }
stdout_thread = Thread.new do
while (line = stdout.gets)
puts "stdout: '#{line}'"
end
end
stdout_thread.join
end
$ ./1.sh
^Cstdout: 'Enter your name: '
This gem is used by mina to, say, execute scripts remotely. And if any command asks for user input, the prompt is never shown. It's not even clear what's going on, it just hangs until interrupted. Is there a way to work around it?
Put the following file on a server:
1.sh:1.rb:This gem is used by
minato, say, execute scripts remotely. And if any command asks for user input, the prompt is never shown. It's not even clear what's going on, it just hangs until interrupted. Is there a way to work around it?