### php.java.bridge

# Class Util.ProcessWithErrorHandler

- `java.lang.Object`

- `java.lang.Process`

- `php.java.bridge.Util.ProcessWithErrorHandler`

Enclosing Class:
  Util

`public static class Util.ProcessWithErrorHandler`
`extends java.lang.Process`

Starts a CGI process with an error handler attached and returns the process handle.

## Method Summary

`void`

`destroy()`
  Kills the subprocess and all of its children forcibly.

`static java.lang.Process`

`start(java.lang.String[] args, java.io.File homeDir, java.util.Map env)`
  Starts a CGI process and returns the process handle.

`int`

`waitFor()`
  The thread calling `waitFor` will block until the subprocess has terminated.

### Methods inherited from class java.lang.Process

`destroy`, `exitValue`, `getErrorStream`, `getInputStream`, `getOutputStream`, `waitFor`

### Methods inherited from class java.lang.Object

`equals`, `getClass`, `hashCode`, `notify`, `notifyAll`, `toString`, `wait`, `wait`, `wait`

## Method Details

### destroy

    public void destroy()

> Kills the subprocess and all of its children forcibly.
> Overrides:
>   destroy in interface java.lang.Process

### start

    public static java.lang.Process start(java.lang.String[] args,
                                          java.io.File homeDir,
                                          java.util.Map env)
                throws java.io.IOException

> Starts a CGI process and returns the process handle.

> Parameters:
>   `args` - The args array, e.g.: new String[]{null, "-b", ...};. If args is null or if args[0] is null, the function looks for the system property "php.java.bridge.php_exec".
>   `homeDir` - The home directory. If null, the system property "user.home" is used.
>   `env` - The CGI environment. If null, Util.DEFAULT_CGI_ENVIRONMENT is used.

> Returns:
>   The process handle.

> Throws:
>   `java.io.IOException` -

> See Also:
>   `Util.checkCgiBinary(StringBuffer)`

### waitFor

    public int waitFor()
                throws java.lang.InterruptedException

> The thread calling `waitFor` will block until the subprocess has terminated. If the process has already terminated then the method immediately returns with the exit value of the subprocess.
> Overrides:
>   waitFor in interface java.lang.Process

> Returns:
>   the subprocess exit value; 0 conventionally denotes success

> Throws:
>   `java.lang.InterruptedException` - if another thread interrupts the blocked one