Top Description Fields Constructors Methods
org.jruby.util.io

public Class POSIXProcess

extends Process
Class Inheritance
Imports
jnr.constants.platform.Errno, .Signal, org.jruby.Ruby, org.jruby.runtime.ThreadContext, java.io.InputStream, .OutputStream

Created by headius on 7/22/14.

Field Summary

Modifier and TypeField and Description
pack-priv volatile Integer
private final long
private final Ruby
pack-priv volatile Integer

Constructor Summary

AccessConstructor and Description
public
POSIXProcess(Ruby runtime, long finalPid)

Method Summary

Modifier and TypeMethod and Description
public void
destroy()

Implements abstract java.lang.Process.destroy.

Kills the process.

public int
exitValue()

Implements abstract java.lang.Process.exitValue.

Returns the exit value for the process.

public InputStream
getErrorStream()

Implements abstract java.lang.Process.getErrorStream.

Returns the input stream connected to the error output of the process.

public InputStream
getInputStream()

Implements abstract java.lang.Process.getInputStream.

Returns the input stream connected to the normal output of the process.

public OutputStream
getOutputStream()

Implements abstract java.lang.Process.getOutputStream.

Returns the output stream connected to the normal input of the process.

public long
pid()

Overrides java.lang.Process.pid.

Returns the native process ID of the process.

public int
public synchronized int
waitFor()

Implements abstract java.lang.Process.waitFor.

Causes the current thread to wait, if necessary, until the process represented by this Process object has terminated.

Inherited from java.lang.Process:
childrendescendantsdestroyForciblyerrorReadererrorReaderinfoinputReaderinputReaderisAliveonExitoutputWriteroutputWritersupportsNormalTerminationtoHandlewaitForwaitFor

Field Detail

exitValueback to summary
pack-priv volatile Integer exitValue
finalPidback to summary
private final long finalPid
runtimeback to summary
private final Ruby runtime
statusback to summary
pack-priv volatile Integer status

Constructor Detail

POSIXProcessback to summary
public POSIXProcess(Ruby runtime, long finalPid)

Method Detail

destroyback to summary
public void destroy()

Implements abstract java.lang.Process.destroy.

Doc from java.lang.Process.destroy.

Kills the process. Whether the process represented by this Process object is normally terminated or not is implementation dependent. Forcible process destruction is defined as the immediate termination of a process, whereas normal termination allows the process to shut down cleanly. If the process is not alive, no action is taken.

The java.util.concurrent.CompletableFuture from onExit is completed when the process has terminated.

Annotations
@Override
exitValueback to summary
public int exitValue()

Implements abstract java.lang.Process.exitValue.

Doc from java.lang.Process.exitValue.

Returns the exit value for the process.

Returns:int

the exit value of the process represented by this Process object. By convention, the value 0 indicates normal termination.

Annotations
@Override
getErrorStreamback to summary
public InputStream getErrorStream()

Implements abstract java.lang.Process.getErrorStream.

Doc from java.lang.Process.getErrorStream.

Returns the input stream connected to the error output of the process. The stream obtains data piped from the error output of the process represented by this Process object.

If the standard error of the process has been redirected using ProcessBuilder.redirectError or ProcessBuilder.redirectErrorStream then this method will return a null input stream.

Returns:InputStream

the input stream connected to the error output of the process

Annotations
@Override
getInputStreamback to summary
public InputStream getInputStream()

Implements abstract java.lang.Process.getInputStream.

Doc from java.lang.Process.getInputStream.

Returns the input stream connected to the normal output of the process. The stream obtains data piped from the standard output of the process represented by this Process object.

If the standard output of the process has been redirected using ProcessBuilder.redirectOutput then this method will return a null input stream.

Otherwise, if the standard error of the process has been redirected using ProcessBuilder.redirectErrorStream then the input stream returned by this method will receive the merged standard output and the standard error of the process.

Returns:InputStream

the input stream connected to the normal output of the process

Annotations
@Override
getOutputStreamback to summary
public OutputStream getOutputStream()

Implements abstract java.lang.Process.getOutputStream.

Doc from java.lang.Process.getOutputStream.

Returns the output stream connected to the normal input of the process. Output to the stream is piped into the standard input of the process represented by this Process object.

If the standard input of the process has been redirected using ProcessBuilder.redirectInput then this method will return a null output stream.

Returns:OutputStream

the output stream connected to the normal input of the process

Annotations
@Override
pidback to summary
public long pid()

Overrides java.lang.Process.pid.

Doc from java.lang.Process.pid.

Returns the native process ID of the process. The native process ID is an identification number that the operating system assigns to the process.

Returns:long

the native process id of the process

statusback to summary
public int status()
waitForback to summary
public synchronized int waitFor() throws InterruptedException

Implements abstract java.lang.Process.waitFor.

Doc from java.lang.Process.waitFor.

Causes the current thread to wait, if necessary, until the process represented by this Process object has terminated. This method returns immediately if the process has already terminated. If the process has not yet terminated, the calling thread will be blocked until the process exits.

Returns:int

the exit value of the process represented by this Process object. By convention, the value 0 indicates normal termination.

Annotations
@Override
Exceptions
InterruptedException:
if the current thread is interrupted by another thread while it is waiting, then the wait is ended and an InterruptedException is thrown.