Skip to content

Commit

Permalink
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions core/src/main/java/org/jruby/RubyIO.java
Original file line number Diff line number Diff line change
@@ -3606,7 +3606,7 @@ private static IRubyObject foreachInternal(ThreadContext context, IRubyObject re
Ruby runtime = context.runtime;
IRubyObject filename = args[0].convertToString();

RubyIO io = newFile(context, runtime.getFile(), new IRubyObject[] { filename });
RubyIO io = newFile(context, runtime.getFile(), new IRubyObject[]{filename});

ByteListCache cache = new ByteListCache();
if (!io.isNil()) {
@@ -3817,7 +3817,7 @@ private static IRubyObject openKeyArgs(ThreadContext context, IRubyObject recv,
((RubyArray)args).push_m19(new IRubyObject[]{path});
((RubyArray)args).concat19(v);

return RubyKernel.open19(context, recv, ((RubyArray)args).toJavaArray(), Block.NULL_BLOCK);
return RubyKernel.open19(context, recv, ((RubyArray) args).toJavaArray(), Block.NULL_BLOCK);
}

return ioOpen(context, path, context.nil, context.nil, opt);
@@ -4494,13 +4494,19 @@ public static IRubyObject popen4(ThreadContext context, IRubyObject recv, IRubyO

private static void cleanupPOpen(POpenTuple tuple) {
if (tuple.input.openFile.isOpen()) {
tuple.input.close();
try {
tuple.input.close();
} catch (RaiseException re) {}
}
if (tuple.output.openFile.isOpen()) {
tuple.output.close();
try {
tuple.output.close();
} catch (RaiseException re) {}
}
if (tuple.error.openFile.isOpen()) {
tuple.error.close();
try {
tuple.error.close();
} catch (RaiseException re) {}
}
}

0 comments on commit f847a3e

Please sign in to comment.