Add ability to launch a Process with a working directory #739
Labels
new feature
A new feature such as a new class, method, package, group of classes, etc.
Milestone
Java's
ProcessBuilder
contains a lot more flexibility than we generally need when launching processes. However, a bunch of times recently I've needed to launch processes in the context of a specific working directory (e.g.git
commands only make sense when in the project directory, and the same is true when running Maven commands).This is to add an overloaded
launch
method inProcesses
andProcessHelper
that accepts a working directory in addition to the command. To avoid ambiguity with varargs parameters in thelaunch(String... command)
methods, probably best to only overload thelaunch
methods that accept aList<String>
.Since
ProcessBuilder#directory(File)
accepts aFile
argument, that's probably what these new methods should accept as well. We could also add two overloads, one that accepts aFile
and one that acceptsPath
, the latter we can easily convert to aFile
.The text was updated successfully, but these errors were encountered: