Changed directory -> workingDirectory (it's more exact what it means)

This commit is contained in:
nathan 2020-08-10 17:46:37 +02:00
parent 1697108b5c
commit 01e09afe49
2 changed files with 11 additions and 12 deletions

View File

@ -244,11 +244,11 @@ open class Executor {
return if (allowedExit != null) { return if (allowedExit != null) {
ProcessAttributes(getCommand(), ProcessAttributes(getCommand(),
getDirectory(), getWorkingDirectory(),
LinkedHashMap(environment), LinkedHashMap(environment),
allowedExit.toSet()) allowedExit.toSet())
} else { } else {
ProcessAttributes(getCommand(), getDirectory(), LinkedHashMap(environment)) ProcessAttributes(getCommand(), getWorkingDirectory(), LinkedHashMap(environment))
} }
} }
@ -391,14 +391,13 @@ open class Executor {
* *
* *
* Subprocesses subsequently started by this object will use this as their working directory. * Subprocesses subsequently started by this object will use this as their working directory.
* The returned value may be `null` -- this means to use *
* the working directory of the current Java process, usually the * The returned value may be `null` -- this means to use the working directory of the current Java process, usually the
* directory named by the system property `user.dir`, * directory named by the system property `user.dir` as the working directory of the child process.
* as the working directory of the child process.
* *
* @return this process executor's working directory * @return this process executor's working directory
*/ */
fun getDirectory(): File? { fun getWorkingDirectory(): File? {
return builder.directory() return builder.directory()
} }
@ -414,7 +413,7 @@ open class Executor {
* *
* @return This process executor. * @return This process executor.
*/ */
fun directory(directory: File?): Executor { fun workingDirectory(directory: File?): Executor {
builder.directory(directory) builder.directory(directory)
return this return this
} }
@ -430,7 +429,7 @@ open class Executor {
* *
* @return This process executor. * @return This process executor.
*/ */
fun directory(directory: String?): Executor { fun workingDirectory(directory: String?): Executor {
if (directory != null) { if (directory != null) {
builder.directory(File(directory)) builder.directory(File(directory))
} else { } else {

View File

@ -327,7 +327,7 @@ class ProcessExecutorMainTest {
val args = listOf("java", TestSetup.getFile(HelloWorld::class.java)) val args = listOf("java", TestSetup.getFile(HelloWorld::class.java))
val exec: Executor = Executor() val exec: Executor = Executor()
.directory(TestSetup.getParentDir(HelloWorld::class.java)) .workingDirectory(TestSetup.getParentDir(HelloWorld::class.java))
exec.command(args) exec.command(args)
val result = runBlocking { val result = runBlocking {