/** * <p>Return the process id (pid) of the process this IO object * spawned. If no process exists (popen was not called), then * nil is returned. This is not how it appears to be defined * but ruby 1.8 works this way.</p> * * @return the pid or nil */ @JRubyMethod public IRubyObject pid(ThreadContext context) { OpenFile myOpenFile = getOpenFileChecked(); if (myOpenFile.getProcess() == null) { return context.nil; } // Of course this isn't particularly useful. long pid = myOpenFile.getPid(); return context.runtime.newFixnum(pid); }
/** * <p>Return the process id (pid) of the process this IO object * spawned. If no process exists (popen was not called), then * nil is returned. This is not how it appears to be defined * but ruby 1.8 works this way.</p> * * @return the pid or nil */ @JRubyMethod public IRubyObject pid(ThreadContext context) { OpenFile myOpenFile = getOpenFileChecked(); if (myOpenFile.getProcess() == null) { return context.nil; } // Of course this isn't particularly useful. long pid = myOpenFile.getPid(); return context.runtime.newFixnum(pid); }
/** * <p>Return the process id (pid) of the process this IO object * spawned. If no process exists (popen was not called), then * nil is returned. This is not how it appears to be defined * but ruby 1.8 works this way.</p> * * @return the pid or nil */ @JRubyMethod(name = "pid") public IRubyObject pid(ThreadContext context) { OpenFile myOpenFile = getOpenFileChecked(); if (myOpenFile.getProcess() == null) { return context.runtime.getNil(); } // Of course this isn't particularly useful. long pid = myOpenFile.getPid(); return context.runtime.newFixnum(pid); }
/** * <p>Return the process id (pid) of the process this IO object * spawned. If no process exists (popen was not called), then * nil is returned. This is not how it appears to be defined * but ruby 1.8 works this way.</p> * * @return the pid or nil */ @JRubyMethod(name = "pid") public IRubyObject pid(ThreadContext context) { OpenFile myOpenFile = getOpenFileChecked(); if (myOpenFile.getProcess() == null) { return context.runtime.getNil(); } // Of course this isn't particularly useful. long pid = myOpenFile.getPid(); return context.runtime.newFixnum(pid); }
protected IRubyObject ioClose(Ruby runtime) { if (openFile == null) return runtime.getNil(); interruptBlockingThreads(); /* FIXME: Why did we go to this trouble and not use these descriptors? ChannelDescriptor main, pipe; if (openFile.getPipeStream() != null) { pipe = openFile.getPipeStream().getDescriptor(); } else { if (openFile.getMainStream() == null) { return runtime.getNil(); } pipe = null; } main = openFile.getMainStream().getDescriptor(); */ // cleanup, raising errors if any openFile.cleanup(runtime, true); // TODO: notify threads waiting on descriptors/IO? probably not... // If this is not a popen3/popen4 stream and it has a process, attempt to shut down that process if (!popenSpecial && openFile.getProcess() != null) { obliterateProcess(openFile.getProcess()); IRubyObject processResult = RubyProcess.RubyStatus.newProcessStatus(runtime, openFile.getProcess().exitValue(), openFile.getPid()); runtime.getCurrentContext().setLastExitStatus(processResult); } return runtime.getNil(); }
protected IRubyObject ioClose(Ruby runtime) { if (openFile == null) return runtime.getNil(); interruptBlockingThreads(); /* FIXME: Why did we go to this trouble and not use these descriptors? ChannelDescriptor main, pipe; if (openFile.getPipeStream() != null) { pipe = openFile.getPipeStream().getDescriptor(); } else { if (openFile.getMainStream() == null) { return runtime.getNil(); } pipe = null; } main = openFile.getMainStream().getDescriptor(); */ // cleanup, raising errors if any openFile.cleanup(runtime, true); // TODO: notify threads waiting on descriptors/IO? probably not... // If this is not a popen3/popen4 stream and it has a process, attempt to shut down that process if (!popenSpecial && openFile.getProcess() != null) { obliterateProcess(openFile.getProcess()); IRubyObject processResult = RubyProcess.RubyStatus.newProcessStatus(runtime, openFile.getProcess().exitValue(), openFile.getPid()); runtime.getCurrentContext().setLastExitStatus(processResult); } return runtime.getNil(); }
IRubyObject processResult = RubyProcess.RubyStatus.newProcessStatus(runtime, ((POSIXProcess) fptr.getProcess()).status(), fptr.getPid()); context.setLastExitStatus(processResult); } else { obliterateProcess(fptr.getProcess()); IRubyObject processResult = RubyProcess.RubyStatus.newProcessStatus(runtime, fptr.getProcess().exitValue() << 8, fptr.getPid()); context.setLastExitStatus(processResult);
IRubyObject processResult = RubyProcess.RubyStatus.newProcessStatus(runtime, ((POSIXProcess) fptr.getProcess()).status(), fptr.getPid()); context.setLastExitStatus(processResult); } else { obliterateProcess(fptr.getProcess()); IRubyObject processResult = RubyProcess.RubyStatus.newProcessStatus(runtime, fptr.getProcess().exitValue() << 8, fptr.getPid()); context.setLastExitStatus(processResult);
try { wfptr.setProcess(fptr.getProcess()); wfptr.setPid(fptr.getPid()); fptr.setProcess(null); fptr.setPid(-1);
try { wfptr.setProcess(fptr.getProcess()); wfptr.setPid(fptr.getPid()); fptr.setProcess(null); fptr.setPid(-1);