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
1515import com .typesafe .sbteclipse .plugin .EclipsePlugin ._
1616
1717import dotty .tools .sbtplugin .DottyPlugin .autoImport ._
18- import dotty .tools .sbtplugin .DottyIDEPlugin .runProcess
18+ import dotty .tools .sbtplugin .DottyIDEPlugin .{ prepareCommand , runProcess }
1919import dotty .tools .sbtplugin .DottyIDEPlugin .autoImport ._
2020import org .scalajs .sbtplugin .ScalaJSPlugin
2121import org .scalajs .sbtplugin .ScalaJSPlugin .autoImport ._
@@ -771,7 +771,7 @@ object Build {
771771 s " --extensionDevelopmentPath= $extensionPath" +:
772772 (if (inputArgs.isEmpty) List ((baseDirectory.value / " .." ).getAbsolutePath) else inputArgs)
773773
774- val clientCommand = codeCommand.value ++ codeArgs
774+ val clientCommand = prepareCommand( codeCommand.value ++ codeArgs)
775775
776776 val allArgs = " -client_command" +: clientCommand
777777
Original file line number Diff line number Diff line change @@ -124,8 +124,17 @@ object DottyIDEPlugin extends AutoPlugin {
124124 runTask(joinedTask, state)
125125 }
126126
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+ */
127136 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()
129138 val pb = if (directory != null ) pb0.directory(directory) else pb0
130139 if (wait) {
131140 val exitCode = pb.start().waitFor()
@@ -221,10 +230,7 @@ object DottyIDEPlugin extends AutoPlugin {
221230 commands ++= Seq (configureIDE, compileForIDE),
222231
223232 codeCommand := {
224- if (isWin)
225- Seq (" cmd.exe" , " /C" , " code" , " -n" )
226- else
227- Seq (" code" , " -n" )
233+ Seq (" code" , " -n" )
228234 },
229235
230236 runCode := {
You can’t perform that action at this time.
0 commit comments