org.apache.commons.exec.ShutdownHookProcessDestroyer Java Examples

The following examples show how to use org.apache.commons.exec.ShutdownHookProcessDestroyer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProcessExecutor.java    From frontend-maven-plugin with Apache License 2.0 5 votes vote down vote up
private Executor createExecutor(File workingDirectory, long timeoutInSeconds) {
    DefaultExecutor executor = new DefaultExecutor();
    executor.setWorkingDirectory(workingDirectory);
    executor.setProcessDestroyer(new ShutdownHookProcessDestroyer());   // Fixes #41

    if (timeoutInSeconds > 0) {
        executor.setWatchdog(new ExecuteWatchdog(timeoutInSeconds * 1000));
    }

    return executor;
}