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 interrupt
    static 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)
    Calls command and blocks until it is complete
    static CommandFunctions.ProcessState callAndWait​(java.lang.String name, java.lang.String command)
    Calls command and blocks until it is complete
    static CommandFunctions.ProcessState callAndWait​(java.lang.String name, java.lang.String command, long timeout)
    Calls command and blocks until it is complete
    static CommandFunctions.ProcessState callAndWait​(java.lang.String name, java.lang.String command, long timeout, java.util.HashMap<java.lang.String,​java.lang.String> environment)
    Calls command and blocks until it is complete
    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)
    Calls command and blocks until it is complete
    static CommandFunctions.ProcessState getProcessState​(int exitVal)
    Returns the ProcessState 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.Exception
      Makes 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.Exception
      Makes 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.Exception
      Makes 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.Exception
      Calls command 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.Exception
      Calls command 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.Exception
      Calls command 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.Exception
      Calls command 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.Exception
      Calls command and blocks until it is complete
      Parameters:
      name -
      command -
      timeout -
      environment -
      Returns:
      Throws:
      java.io.IOException
      java.lang.Exception
    • getProcessState

      public static CommandFunctions.ProcessState getProcessState​(int exitVal)
      Returns the ProcessState corresponding to the system exit value.
      Parameters:
      exitVal -
      Returns: