ProcessBuilder or Exec for calling external compiler from WorkAction?

I don’t think there is really a good way to abort already scheduled work if one of the work-items failed.

An instance of Exec you cannot use, Exec is a task.
But if you meant injecting ExecOperations and using exec { ... } on it, then yes, I’d prefer that over a plain ProcessBuilder.
You get an ExecResult from which you can get the exit code if you need more than “fail if != 0”.
You can set the standard streams to anything you need to provide and consume the content as necessary, …

The parallel execution you already have by using the worker api, that is one of its major benefits.

1 Like