Class DefaultProcess
- java.lang.Object
-
- net.rubygrapefruit.platform.internal.DefaultProcess
-
- All Implemented Interfaces:
NativeIntegration
,Process
public class DefaultProcess extends Object implements Process
-
-
Constructor Summary
Constructors Constructor Description DefaultProcess()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
detach()
Detaches this process from the parent to ignore ctrl-c.String
getEnvironmentVariable(String name)
Get the value of an environment variable.int
getProcessId()
Returns the process identifier.File
getWorkingDirectory()
Returns the process' current working directory.void
setEnvironmentVariable(String name, String value)
Sets the value of an environment variable.void
setWorkingDirectory(File directory)
Sets the process' working directory.
-
-
-
Method Detail
-
getProcessId
public int getProcessId() throws NativeException
Description copied from interface:Process
Returns the process identifier.- Specified by:
getProcessId
in interfaceProcess
- Throws:
NativeException
- On failure.
-
detach
public void detach() throws NativeException
Description copied from interface:Process
Detaches this process from the parent to ignore ctrl-c.- Specified by:
detach
in interfaceProcess
- Throws:
NativeException
- On failure.
-
getWorkingDirectory
public File getWorkingDirectory() throws NativeException
Description copied from interface:Process
Returns the process' current working directory.- Specified by:
getWorkingDirectory
in interfaceProcess
- Throws:
NativeException
- On failure.
-
setWorkingDirectory
public void setWorkingDirectory(File directory) throws NativeException
Description copied from interface:Process
Sets the process' working directory.- Specified by:
setWorkingDirectory
in interfaceProcess
- Throws:
NativeException
- On failure.
-
getEnvironmentVariable
public String getEnvironmentVariable(String name) throws NativeException
Description copied from interface:Process
Get the value of an environment variable.- Specified by:
getEnvironmentVariable
in interfaceProcess
- 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
public void setEnvironmentVariable(String name, String value) throws NativeException
Description copied from interface:Process
Sets the value of an environment variable.- Specified by:
setEnvironmentVariable
in interfaceProcess
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.
-
-