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 classCommandFunctions.ProcessState -
Constructor Summary
Constructors Constructor Description CommandFunctions() -
Method Summary
Modifier and Type Method Description static java.lang.Processcall(java.lang.String command)Makes a call to the command console and returns immediately TODO: allow an ESC interruptstatic java.lang.Processcall(java.lang.String name, java.lang.String command)Makes a call to the command console and returns immediately.static java.lang.Processcall(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.ProcessStatecallAndWait(java.lang.String command)Callscommandand blocks until it is completestatic CommandFunctions.ProcessStatecallAndWait(java.lang.String name, java.lang.String command)Callscommandand blocks until it is completestatic CommandFunctions.ProcessStatecallAndWait(java.lang.String name, java.lang.String command, long timeout)Callscommandand blocks until it is completestatic CommandFunctions.ProcessStatecallAndWait(java.lang.String name, java.lang.String command, long timeout, java.util.HashMap<java.lang.String,java.lang.String> environment)Callscommandand blocks until it is completestatic CommandFunctions.ProcessStatecallAndWait(java.lang.String name, java.lang.String command, long timeout, java.util.HashMap<java.lang.String,java.lang.String> environment, boolean fail_on_err)Callscommandand blocks until it is completestatic CommandFunctions.ProcessStategetProcessState(int exitVal)Returns theProcessStatecorresponding 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.IOExceptionjava.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.ExceptionCallscommandand blocks until it is complete- Parameters:
command-- Returns:
- Throws:
java.io.IOExceptionjava.lang.Exception
-
callAndWait
public static CommandFunctions.ProcessState callAndWait(java.lang.String name, java.lang.String command) throws java.lang.ExceptionCallscommandand blocks until it is complete- Parameters:
name-command-timeout-- Returns:
- Throws:
java.io.IOExceptionjava.lang.Exception
-
callAndWait
public static CommandFunctions.ProcessState callAndWait(java.lang.String name, java.lang.String command, long timeout) throws java.lang.ExceptionCallscommandand blocks until it is complete- Parameters:
name-command-timeout-- Returns:
- Throws:
java.io.IOExceptionjava.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.ExceptionCallscommandand blocks until it is complete- Parameters:
name-command-timeout-environment-- Returns:
- Throws:
java.io.IOExceptionjava.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.ExceptionCallscommandand blocks until it is complete- Parameters:
name-command-timeout-environment-- Returns:
- Throws:
java.io.IOExceptionjava.lang.Exception
-
getProcessState
Returns theProcessStatecorresponding to the system exit value.- Parameters:
exitVal-- Returns:
-