3 ms·
Are the features you listed something that other process libs really have trouble with? Personally when I'm dealing with something as low level as forking proce
by benjamincburns 13y ago
Are the features you listed something that other process libs really have trouble with? Personally when I'm dealing with something as low level as forking processes, I like to worry about implementing the kind of stuff you list as features. Does your project offer the ability to override its default behavior, or is this more in support of the general pattern you tend to use for your own projects?
You mention "writing lots of helpers to get rid of the boiler plate." Can you offer an example? Putting a boilerplate-heavy example next to a beautiful two or three lines of equivalent code that uses your API really helps people to grok your goals.
If I sound critical, I sincerely apologize. As someone who writes a ton of code I'm always so thankful for people who take the time to package up and share their work. It's really quite a nontrivial thing to do.
- shelajev 13y agoBeing able to configure stuff that is listed as features is a natural requirement. And it is supported: process listeners, process destroyers, stream handlers - all are behind interfaces, you can supply your own implementation. Some things maybe aren't that flexible (ProcessBuilder, I'm looking at you), but if you find a need to extend their behavior, create an issue, we will be happy to change that. Default settings are sensible and fit the use case of: start process, consume and return its output/error streams, check error code. Common use-cases like killing process when parent JVM exits are supported with one-liner calls, etc. It was aimed to be friendly. Finally, the comparison with other frameworks. You can find a couple of examples in the [readme file](https://github.com/zeroturnaround/zt-exec/blob/master/README.md https://github.com/zeroturnaround/zt-exec/blob/master/README...) on github. Also tests somewhat reveal the feel of the api. My favorite feature is that it supports futures. When you want to run your process async mode commons-exec tutorial suggests: executor.execute(cmdLine, resultHandler); // some time later the result handler callback was invoked so we // can safely request the exit value int exitValue = resultHandler.waitFor(); zt-exec has: Future<ProcessResult> future = new ProcessExecutor() .command("java", "-version") .start(); // do some stuff future.get(60, TimeUnit.SECONDS); You get a process library that works well with java's default async framework. Hope it gives some insight. If you have any more questions, I'll be happy to help to the best of my abilities. disclaimer: I'm working for ZeroTurnaround, but I haven't been directly involved in creating or making zt-exec publicly available.