Package net.rubygrapefruit.platform
Interface Process
-
- All Superinterfaces:
NativeIntegration
- All Known Implementing Classes:
DefaultProcess,WrapperProcess
public interface Process extends NativeIntegration
Functions to query and modify a process' state.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddetach()Detaches this process from the parent to ignore ctrl-c.java.lang.StringgetEnvironmentVariable(java.lang.String name)Get the value of an environment variable.intgetProcessId()Returns the process identifier.java.io.FilegetWorkingDirectory()Returns the process' current working directory.voidsetEnvironmentVariable(java.lang.String name, java.lang.String value)Sets the value of an environment variable.voidsetWorkingDirectory(java.io.File directory)Sets the process' working directory.
-
-
-
Method Detail
-
getProcessId
int getProcessId() throws NativeExceptionReturns the process identifier.- Throws:
NativeException- On failure.
-
detach
void detach() throws NativeExceptionDetaches this process from the parent to ignore ctrl-c.- Throws:
NativeException- On failure.
-
getWorkingDirectory
java.io.File getWorkingDirectory() throws NativeExceptionReturns the process' current working directory.- Throws:
NativeException- On failure.
-
setWorkingDirectory
void setWorkingDirectory(java.io.File directory) throws NativeExceptionSets the process' working directory.- Throws:
NativeException- On failure.
-
getEnvironmentVariable
java.lang.String getEnvironmentVariable(java.lang.String name) throws NativeExceptionGet the value of an environment variable.- Returns:
- The value or null if no such environment variable. Also returns null for an environment variable whose value is an empty string.
- Throws:
NativeException- On failure.
-
setEnvironmentVariable
void setEnvironmentVariable(java.lang.String name, java.lang.String value) throws NativeExceptionSets the value of an environment variable.- Parameters:
value- the new value. Use null or an empty string to remove the environment variable. Note that on some platforms it is not possible to remove the environment variable safely. On such platforms, the value is set to an empty string instead.- Throws:
NativeException- On failure.
-
-