Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For #307: Error chomp on nil #308

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified bin/svn2git
100644 → 100755
Empty file.
10 changes: 9 additions & 1 deletion lib/svn2git/migration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,15 @@ def run_command(cmd, exit_on_error=true, printout_output=false)
# for input and place any received values on a queue for consumption by a pass-through thread that will forward
# the contents to the underlying sub-process's stdin pipe.
@stdin_thread ||= Thread.new do
loop { @stdin_queue << $stdin.gets.chomp }
loop do
# gets may return nil, and nil cannot be chomped
input = $stdin.gets
if input.nil?
@stdin_queue << input
else
@stdin_queue << input.chomp
end
end
end

# Open4 forks, which JRuby doesn't support. But JRuby added a popen4-compatible method on the IO class,
Expand Down