Skip to content

Commit 3615d58

Browse files
authored
Merge pull request jruby#9351 from headius/fix_windows_popen_kwargs
Fix non-native IO.popen env + kwargs handling
2 parents 831e875 + c448609 commit 3615d58

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

core/src/main/java/org/jruby/RubyIO.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4518,13 +4518,15 @@ public static IRubyObject popen(ThreadContext context, IRubyObject recv, IRubyOb
45184518

45194519
int firstArg = 0;
45204520

4521-
if (argc > 0 && !TypeConverter.checkHashType(runtime, args[0]).isNil()) {
4522-
firstArg++;
4521+
// process trailing keyword arguments hash
4522+
if (argc > 0 && !(tmp = TypeConverter.checkHashType(runtime, args[argc - 1])).isNil()) {
4523+
options = (RubyHash)tmp;
45234524
argc--;
45244525
}
45254526

4526-
if (argc > 0 && !(tmp = TypeConverter.checkHashType(runtime, args[argc - 1])).isNil()) {
4527-
options = (RubyHash)tmp;
4527+
// process leading env hash
4528+
if (argc > 0 && !TypeConverter.checkHashType(runtime, args[0]).isNil()) {
4529+
firstArg++;
45284530
argc--;
45294531
}
45304532

0 commit comments

Comments
 (0)