redirect = true; } else { IRubyObject cmd = PopenExecutor.checkPipeCommand(context, tmp); if (cmd != context.nil) { args[0] = cmd;
redirect = true; } else { IRubyObject cmd = PopenExecutor.checkPipeCommand(context, tmp); if (cmd != context.nil) { args[0] = cmd;
private static RubyIO ioOpenGeneric(ThreadContext context, IRubyObject recv, IRubyObject filename, int oflags, int fmode, IOEncodable convconfig, int perm) { final Ruby runtime = context.runtime; IRubyObject cmd; if ((filename instanceof RubyString) && ((RubyString) filename).isEmpty()) { throw runtime.newErrnoENOENTError(); } boolean warn = recv == runtime.getFile(); if ((warn || recv == runtime.getIO()) && (cmd = PopenExecutor.checkPipeCommand(context, filename)) != context.nil) { if (recv != runtime.getIO()) { // FIXME: use actual called name instead of "open" as in MRI String message = "IO.open called on " + recv + " to invoke external command"; if (warn) { runtime.getWarnings().warn(message); } } return (RubyIO) PopenExecutor.pipeOpen(context, cmd, OpenFile.ioOflagsModestr(runtime, oflags), fmode, convconfig); } return (RubyIO) ((RubyFile) runtime.getFile().allocate()).fileOpenGeneric(context, filename, oflags, fmode, convconfig, perm); }
private static RubyIO ioOpenGeneric(ThreadContext context, IRubyObject recv, IRubyObject filename, int oflags, int fmode, IOEncodable convconfig, int perm) { final Ruby runtime = context.runtime; IRubyObject cmd; if ((filename instanceof RubyString) && ((RubyString) filename).isEmpty()) { throw runtime.newErrnoENOENTError(); } boolean warn = recv == runtime.getFile(); if ((warn || recv == runtime.getIO()) && (cmd = PopenExecutor.checkPipeCommand(context, filename)) != context.nil) { if (recv != runtime.getIO()) { // FIXME: use actual called name instead of "open" as in MRI String message = "IO.open called on " + recv + " to invoke external command"; if (warn) { runtime.getWarnings().warn(message); } } return (RubyIO) PopenExecutor.pipeOpen(context, cmd, OpenFile.ioOflagsModestr(runtime, oflags), fmode, convconfig); } return (RubyIO) ((RubyFile) runtime.getFile().allocate()).fileOpenGeneric(context, filename, oflags, fmode, convconfig, perm); }