Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johnlcox/process-warden
A wrapper for Process and ProcessBuilder that makes their use safer by handling some of the gotchas inherit in them.
https://github.com/johnlcox/process-warden
Last synced: about 2 months ago
JSON representation
A wrapper for Process and ProcessBuilder that makes their use safer by handling some of the gotchas inherit in them.
- Host: GitHub
- URL: https://github.com/johnlcox/process-warden
- Owner: johnlcox
- License: other
- Created: 2013-01-20T17:12:39.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-04-16T03:42:39.000Z (over 11 years ago)
- Last Synced: 2024-04-16T11:19:58.011Z (9 months ago)
- Language: Java
- Homepage:
- Size: 246 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# process-warden
[![Build Status](https://travis-ci.org/johnlcox/process-warden.png)](https://travis-ci.org/johnlcox/process-warden)
process-warden provides a safer wrapper around the built in Java Process and ProcessBuilder classes for executing native subprocesses.
## Usage
With Java 6:
```java
FinalizedProcessBuilder pb = new FinalizedProcessBuilder("myCommand", "myArg");
FinalizedProcess process = pb.start();
try {
int returnVal = process.waitFor(5000);
} finally {
process.close();
}
```With Java 7 and try-with-resources:
```java
FinalizedProcessBuilder pb = new FinalizedProcessBuilder("myCommand", "myArg");
try (FinalizedProcess process = pb.start()) {
int returnVal = process.waitFor(5000);
}
```Now With Stream Gobbling. The StreamGobbler will gobble up the input stream, error stream, or both in a separate thread to prevent from blocking your thread.
```java
FinalizedProcessBuilder pb = new FinalizedProcessBuilder("myCommand", "myArg");
pb.gobbleStreams(true);
try (FinalizedProcess process = pb.start()) {
int returnVal = process.waitFor(5000);
}
```## Installation
Add it as a maven dependency:
```xmlcom.leacox.process
process-warden
1.1.0```
## License
Copyright 2013 John Leacox
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.