If you use a backtick operator, any data going through STDIN ends up going to that process during the time it is executing. Attached find an example that if you run it via:
cat test_file.txt | jruby test.rb
You will see "nil" whereas
cat test_file.txt | ruby test.rb
You will see "hello"
The reason for this is because of the presence of a `ls` on the first line of the script. Apparently STDIN gets corrupted due to this backtick.