This repository was archived by the owner on Jul 6, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
jetbrains/src/main/kotlin/dev/buijs/klutter/jetbrains/shared
tasks/src/main/kotlin/dev/buijs/klutter/tasks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ class JetbrainsExecutor: Executor() {
3535 timeout : Long? ,
3636 command : String ,
3737 environment : Map <String , String >,
38- ): String = GeneralCommandLine (command.split( " " ) )
38+ ): String = GeneralCommandLine (command.platformSpecific )
3939 .also { it.workDirectory = runFrom }
4040 .also { it.environment.putAll(environment) }
4141 .createProcess()
Original file line number Diff line number Diff line change @@ -29,16 +29,24 @@ import java.util.concurrent.TimeUnit
2929
3030var executor: Executor = Executor ()
3131
32- infix fun String.execute (file : File ) =
33- executor.execute(
34- runFrom = file,
35- command = if (isWindows) " cmd.exe /c $this " else this )
32+ infix fun String . execute (file : File ) =
33+ executor.execute(runFrom = file, command = this )
3634
3735/* *
3836 * Execute a CLI command.
3937 */
4038open class Executor {
4139
40+ val String .platformSpecific: List <String >
41+ get()= buildList {
42+ if (isWindows) {
43+ add(" cmd.exe" )
44+ add(" /c" )
45+ }
46+
47+ addAll(split(" " ))
48+ }
49+
4250 /* *
4351 * Execute a CLI command.
4452 */
@@ -65,7 +73,7 @@ open class Executor {
6573 */
6674 environment : Map <String ,String > = emptyMap(),
6775 ): String = ProcessBuilder ()
68- .command(command.split( " " ) )
76+ .command(command.platformSpecific )
6977 .directory(runFrom)
7078 .also { it.environment().putAll(environment)}
7179 .start()
You can’t perform that action at this time.
0 commit comments