## net.i2p.util
Class ShellCommand

    java.lang.Object
      net.i2p.util.ShellCommand

public class ShellCommand
extends java.lang.Object

Passes a command to the OS shell for execution and manages the input and output.

This class must be kept `gcj`-compatible.

Author:
  hypercubus

Constructor Summary
`ShellCommand()`

Method Summary
`void` `execute(java.lang.String shellCommand)` Passes a command to the shell for execution and returns immediately without waiting for an exit status.
`boolean` `executeAndWait(java.lang.String shellCommand)` Passes a command to the shell for execution.
`boolean` `executeAndWaitTimed(java.lang.String shellCommand, int seconds)` Passes a command to the shell for execution.
`void` `executeSilent(java.lang.String shellCommand)` Passes a command to the shell for execution and returns immediately without waiting for an exit status.
`boolean` `executeSilentAndWait(java.lang.String shellCommand)` Passes a command to the shell for execution.
`boolean` `executeSilentAndWaitTimed(java.lang.String shellCommand, int seconds)` Passes a command to the shell for execution.
`java.io.InputStream` `getErrorStream()`
`java.io.InputStream` `getInputStream()`
`java.io.OutputStream` `getOutputStream()`
`static void` `main(java.lang.String[] args)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ShellCommand

    public ShellCommand()

Method Detail

### execute

    public void execute(java.lang.String shellCommand)

  Passes a command to the shell for execution and returns immediately without waiting for an exit status. All output produced by the executed command will go to `STDOUT` and `STDERR` as appropriate, and can be read via `getOutputStream()` and `getErrorStream()`, respectively. Input can be passed to the `STDIN` of the shell process via `getInputStream()`.

  Parameters:
    `shellCommand` - The command for the shell to execute.

### executeAndWait

    public boolean executeAndWait(java.lang.String shellCommand)

  Passes a command to the shell for execution. This method blocks until all of the command's resulting shell processes have completed. All output produced by the executed command will go to `STDOUT` and `STDERR` as appropriate, and can be read via `getOutputStream()` and `getErrorStream()`, respectively. Input can be passed to the `STDIN` of the shell process via `getInputStream()`.

  Parameters:
    `shellCommand` - The command for the shell to execute.
  Returns:
    `true` if the spawned shell process returns an exit status of 0 (indicating success), else `false`.

### executeAndWaitTimed

    public boolean executeAndWaitTimed(java.lang.String shellCommand,
                                       int seconds)

  Passes a command to the shell for execution. This method blocks until all of the command's resulting shell processes have completed, unless a specified number of seconds has elapsed first. All output produced by the executed command will go to `STDOUT` and `STDERR` as appropriate, and can be read via `getOutputStream()` and `getErrorStream()`, respectively. Input can be passed to the `STDIN` of the shell process via `getInputStream()`.

  Parameters:
    `shellCommand` - The command for the shell to execute.
    `seconds` - The method will return `true` if this number of seconds elapses without the process returning an exit status. A value of `0` here disables waiting.
  Returns:
    `true` if the spawned shell process returns an exit status of 0 (indicating success), else `false`.

### executeSilent

    public void executeSilent(java.lang.String shellCommand)
                       throws java.io.IOException

  Passes a command to the shell for execution and returns immediately without waiting for an exit status. Any output produced by the executed command will not be displayed.

  Parameters:
    `shellCommand` - The command for the shell to execute.
  Throws:
    `java.io.IOException`

### executeSilentAndWait

    public boolean executeSilentAndWait(java.lang.String shellCommand)

  Passes a command to the shell for execution. This method blocks until all of the command's resulting shell processes have completed. Any output produced by the executed command will not be displayed.

  Parameters:
    `shellCommand` - The command for the shell to execute.
  Returns:
    `true` if the spawned shell process returns an exit status of 0 (indicating success), else `false`.

### executeSilentAndWaitTimed

    public boolean executeSilentAndWaitTimed(java.lang.String shellCommand,
                                             int seconds)

  Passes a command to the shell for execution. This method blocks until all of the command's resulting shell processes have completed unless a specified number of seconds has elapsed first. Any output produced by the executed command will not be displayed.

  Parameters:
    `shellCommand` - The command for the shell to execute.
    `seconds` - The method will return `true` if this number of seconds elapses without the process returning an exit status. A value of `0` here disables waiting.
  Returns:
    `true` if the spawned shell process returns an exit status of 0 (indicating success), else `false`.

### getErrorStream

    public java.io.InputStream getErrorStream()

### getInputStream

    public java.io.InputStream getInputStream()

### getOutputStream

    public java.io.OutputStream getOutputStream()

### main

    public static void main(java.lang.String[] args)