private static void checkExecRedirectDefault(Ruby runtime, IRubyObject key, IRubyObject val, ExecArg eargp) { IRubyObject tmp; IRubyObject param; tmp = val; val = TypeConverter.ioCheckIO(runtime, tmp); if (!val.isNil()) { val = checkExecRedirectFd(runtime, val, false); param = val; eargp.fd_dup2 = checkExecRedirect1(runtime, eargp.fd_dup2, key, param); } throw runtime.newArgumentError("wrong exec redirect action"); }
private static void checkExecRedirectDefault(Ruby runtime, IRubyObject key, IRubyObject val, ExecArg eargp) { IRubyObject tmp; IRubyObject param; tmp = val; val = TypeConverter.ioCheckIO(runtime, tmp); if (!val.isNil()) { val = checkExecRedirectFd(runtime, val, false); param = val; eargp.fd_dup2 = checkExecRedirect1(runtime, eargp.fd_dup2, key, param); } throw runtime.newArgumentError("wrong exec redirect action"); }
public IRubyObject write(ThreadContext context, IRubyObject str, boolean nosync) { Ruby runtime = context.runtime; OpenFile fptr; long n; IRubyObject tmp; RubyIO io = GetWriteIO(); str = str.asString(); tmp = TypeConverter.ioCheckIO(runtime, io); if (tmp == context.nil) { /* port is not IO, call write method for it. */ return sites(context).write.call(context, io, io, str); } io = (RubyIO) tmp; if (((RubyString) str).size() == 0) return RubyFixnum.zero(runtime); fptr = io.getOpenFileChecked(); boolean locked = fptr.lock(); try { fptr = io.getOpenFileChecked(); fptr.checkWritable(context); n = fptr.fwrite(context, str, nosync); if (n == -1) throw runtime.newErrnoFromErrno(fptr.errno(), fptr.getPath()); } finally { if (locked) fptr.unlock(); } return RubyFixnum.newFixnum(runtime, n); }
public IRubyObject write(ThreadContext context, IRubyObject str, boolean nosync) { Ruby runtime = context.runtime; OpenFile fptr; long n; IRubyObject tmp; RubyIO io = GetWriteIO(); str = str.asString(); tmp = TypeConverter.ioCheckIO(runtime, io); if (tmp == context.nil) { /* port is not IO, call write method for it. */ return sites(context).write.call(context, io, io, str); } io = (RubyIO) tmp; if (((RubyString) str).size() == 0) return RubyFixnum.zero(runtime); fptr = io.getOpenFileChecked(); boolean locked = fptr.lock(); try { fptr = io.getOpenFileChecked(); fptr.checkWritable(context); n = fptr.fwrite(context, str, nosync); if (n == -1) throw runtime.newErrnoFromErrno(fptr.errno(), fptr.getPath()); } finally { if (locked) fptr.unlock(); } return RubyFixnum.newFixnum(runtime, n); }
IRubyObject tmp = TypeConverter.ioCheckIO(runtime, fname); if (tmp != nil) { return file.reopenIO(context, (RubyIO) tmp);
IRubyObject tmp = TypeConverter.ioCheckIO(runtime, fname); if (tmp != nil) { return file.reopenIO(context, (RubyIO) tmp);