Package mgui.command
Class CommandFunctions
java.lang.Object
mgui.interfaces.Utility
mgui.command.CommandFunctions
public class CommandFunctions extends Utility
Utility class providing functions to interact with the operating system.
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CommandFunctions.ProcessState
-
Constructor Summary
Constructors Constructor Description CommandFunctions()
-
Method Summary
Modifier and Type Method Description static java.lang.Process
call(java.lang.String command)
Makes a call to the command console and returns immediately TODO: allow an ESC interruptstatic java.lang.Process
call(java.lang.String name, java.lang.String command)
Makes a call to the command console and returns immediately.static java.lang.Process
call(java.lang.String name, java.lang.String command, java.util.HashMap<java.lang.String,java.lang.String> environment)
Makes a call to the command console and returns immediately.static CommandFunctions.ProcessState
callAndWait(java.lang.String command)
Callscommand
and blocks until it is completestatic CommandFunctions.ProcessState
callAndWait(java.lang.String name, java.lang.String command)
Callscommand
and blocks until it is completestatic CommandFunctions.ProcessState
callAndWait(java.lang.String name, java.lang.String command, long timeout)
Callscommand
and blocks until it is completestatic CommandFunctions.ProcessState
callAndWait(java.lang.String name, java.lang.String command, long timeout, java.util.HashMap<java.lang.String,java.lang.String> environment)
Callscommand
and blocks until it is completestatic CommandFunctions.ProcessState
callAndWait(java.lang.String name, java.lang.String command, long timeout, java.util.HashMap<java.lang.String,java.lang.String> environment, boolean fail_on_err)
Callscommand
and blocks until it is completestatic CommandFunctions.ProcessState
getProcessState(int exitVal)
Returns theProcessState
corresponding to the system exit value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
CommandFunctions
public CommandFunctions()
-
-
Method Details
-
call
public static java.lang.Process call(java.lang.String command) throws java.lang.ExceptionMakes a call to the command console and returns immediately TODO: allow an ESC interrupt- Parameters:
command
-- Throws:
java.io.IOException
java.lang.Exception
-
call
public static java.lang.Process call(java.lang.String name, java.lang.String command) throws java.lang.ExceptionMakes a call to the command console and returns immediately. TODO: allow an ESC interrupt- Parameters:
command
-name
-- Throws:
java.lang.Exception
-
call
public static java.lang.Process call(java.lang.String name, java.lang.String command, java.util.HashMap<java.lang.String,java.lang.String> environment) throws java.lang.ExceptionMakes a call to the command console and returns immediately. TODO: allow an ESC interrupt- Parameters:
command
-name
-environment
-- Throws:
java.lang.Exception
-
callAndWait
public static CommandFunctions.ProcessState callAndWait(java.lang.String command) throws java.lang.ExceptionCallscommand
and blocks until it is complete- Parameters:
command
-- Returns:
- Throws:
java.io.IOException
java.lang.Exception
-
callAndWait
public static CommandFunctions.ProcessState callAndWait(java.lang.String name, java.lang.String command) throws java.lang.ExceptionCallscommand
and blocks until it is complete- Parameters:
name
-command
-timeout
-- Returns:
- Throws:
java.io.IOException
java.lang.Exception
-
callAndWait
public static CommandFunctions.ProcessState callAndWait(java.lang.String name, java.lang.String command, long timeout) throws java.lang.ExceptionCallscommand
and blocks until it is complete- Parameters:
name
-command
-timeout
-- Returns:
- Throws:
java.io.IOException
java.lang.Exception
-
callAndWait
public static CommandFunctions.ProcessState callAndWait(java.lang.String name, java.lang.String command, long timeout, java.util.HashMap<java.lang.String,java.lang.String> environment) throws java.lang.ExceptionCallscommand
and blocks until it is complete- Parameters:
name
-command
-timeout
-environment
-- Returns:
- Throws:
java.io.IOException
java.lang.Exception
-
callAndWait
public static CommandFunctions.ProcessState callAndWait(java.lang.String name, java.lang.String command, long timeout, java.util.HashMap<java.lang.String,java.lang.String> environment, boolean fail_on_err) throws java.lang.ExceptionCallscommand
and blocks until it is complete- Parameters:
name
-command
-timeout
-environment
-- Returns:
- Throws:
java.io.IOException
java.lang.Exception
-
getProcessState
Returns theProcessState
corresponding to the system exit value.- Parameters:
exitVal
-- Returns:
-