Skip to content

Commit 2417fb3

Browse files
sagirusergiomb2
authored andcommitted
Use global stdin instead of local variable
The stdin bypass will use a local variable stdin instead of $stdin and it will result in the following error: Traceback (most recent call last): 2: from /usr/lib/ruby/vendor_ruby/svn2git/migration.rb:432:in `block (2 levels) in run_command' 1: from /usr/lib/ruby/vendor_ruby/svn2git/migration.rb:432:in `loop' /usr/lib/ruby/vendor_ruby/svn2git/migration.rb:438:in `block (3 levels) in run_command': undefined local variable or method `stdin' for #<Svn2Git::Migration:0x0000555b7c945cc8> (NameError) Did you mean? String This fix should handle the error and uses the global stdin
1 parent d8b519b commit 2417fb3

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/svn2git/migration.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -430,13 +430,17 @@ def run_command(cmd, exit_on_error=true, printout_output=false)
430430
# sub-process's stdin pipe.
431431
Thread.new do
432432
loop do
433-
user_reply = @stdin_queue.pop
433+
begin
434+
user_reply = @stdin_queue.pop
434435

435-
# nil is our cue to stop looping (pun intended).
436-
break if user_reply.nil?
436+
# nil is our cue to stop looping (pun intended).
437+
break if user_reply.nil?
437438

438-
stdin.puts user_reply
439-
stdin.close
439+
$stdin.puts user_reply
440+
$stdin.close
441+
rescue IOError
442+
$stdout.print "No input requested.\n"
443+
end
440444
end
441445
end
442446

0 commit comments

Comments
 (0)