File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
sbt-dotty/src/dotty/tools/sbtplugin Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import sbt.Package.ManifestAttributes
15
15
import com .typesafe .sbteclipse .plugin .EclipsePlugin ._
16
16
17
17
import dotty .tools .sbtplugin .DottyPlugin .autoImport ._
18
- import dotty .tools .sbtplugin .DottyIDEPlugin .runProcess
18
+ import dotty .tools .sbtplugin .DottyIDEPlugin .{ prepareCommand , runProcess }
19
19
import dotty .tools .sbtplugin .DottyIDEPlugin .autoImport ._
20
20
import org .scalajs .sbtplugin .ScalaJSPlugin
21
21
import org .scalajs .sbtplugin .ScalaJSPlugin .autoImport ._
@@ -771,7 +771,7 @@ object Build {
771
771
s " --extensionDevelopmentPath= $extensionPath" +:
772
772
(if (inputArgs.isEmpty) List ((baseDirectory.value / " .." ).getAbsolutePath) else inputArgs)
773
773
774
- val clientCommand = codeCommand.value ++ codeArgs
774
+ val clientCommand = prepareCommand( codeCommand.value ++ codeArgs)
775
775
776
776
val allArgs = " -client_command" +: clientCommand
777
777
Original file line number Diff line number Diff line change @@ -124,8 +124,17 @@ object DottyIDEPlugin extends AutoPlugin {
124
124
runTask(joinedTask, state)
125
125
}
126
126
127
+ /** Prepare command to be passed to ProcessBuilder */
128
+ def prepareCommand (cmd : Seq [String ]): Seq [String ] =
129
+ if (isWin) Seq (" cmd.exe" , " /C" ) ++ cmd
130
+ else cmd
131
+
132
+ /** Run `cmd`.
133
+ * @param wait If true, wait for `cmd` to return and throw an exception if the exit code is non-zero.
134
+ * @param directory If not null, run `cmd` in this directory.
135
+ */
127
136
def runProcess (cmd : Seq [String ], wait : Boolean = false , directory : File = null ): Unit = {
128
- val pb0 = new ProcessBuilder (cmd : _* ).inheritIO()
137
+ val pb0 = new ProcessBuilder (prepareCommand( cmd) : _* ).inheritIO()
129
138
val pb = if (directory != null ) pb0.directory(directory) else pb0
130
139
if (wait) {
131
140
val exitCode = pb.start().waitFor()
@@ -221,10 +230,7 @@ object DottyIDEPlugin extends AutoPlugin {
221
230
commands ++= Seq (configureIDE, compileForIDE),
222
231
223
232
codeCommand := {
224
- if (isWin)
225
- Seq (" cmd.exe" , " /C" , " code" , " -n" )
226
- else
227
- Seq (" code" , " -n" )
233
+ Seq (" code" , " -n" )
228
234
},
229
235
230
236
runCode := {
You can’t perform that action at this time.
0 commit comments