Sorry I can’t figure out how to find the cause of this myself. I’m sure
there’s some article somewhere I’m not finding.
on RHEL4 u3, ruby 1.8, create:
my_pipe = IO.popen("ssh foreign-host ‘cat filename’)
file_contents = my_pipe.read
inp = $stdin.read
puts "returning " + inp
Run this app from this host (call it ServerB):
ruby app.rb <<EOF
You get “returning hi there”, as expected.
Now, from ServerA (public keys have been pushed), run:
ssh ServerB ‘ruby app.rb’ <<EOF
it fails, in that inp receives nothing from $stdin.
now, go back to app.rb, remove the first three lines so there’s no call
run it again, it works.
why does $stdin get “moved” when the app is called remotely and opens a