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 void
detach()
Detaches this process from the parent to ignore ctrl-c.java.lang.String
getEnvironmentVariable(java.lang.String name)
Get the value of an environment variable.int
getProcessId()
Returns the process identifier.java.io.File
getWorkingDirectory()
Returns the process' current working directory.void
setEnvironmentVariable(java.lang.String name, java.lang.String value)
Sets the value of an environment variable.void
setWorkingDirectory(java.io.File directory)
Sets the process' working directory.
-
-
-
Method Detail
-
getProcessId
int getProcessId() throws NativeException
Returns the process identifier.- Throws:
NativeException
- On failure.
-
detach
void detach() throws NativeException
Detaches this process from the parent to ignore ctrl-c.- Throws:
NativeException
- On failure.
-
getWorkingDirectory
java.io.File getWorkingDirectory() throws NativeException
Returns the process' current working directory.- Throws:
NativeException
- On failure.
-
setWorkingDirectory
void setWorkingDirectory(java.io.File directory) throws NativeException
Sets the process' working directory.- Throws:
NativeException
- On failure.
-
getEnvironmentVariable
java.lang.String getEnvironmentVariable(java.lang.String name) throws NativeException
Get 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 NativeException
Sets 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.
-
-