views:

71

answers:

1

Here's the code I have:

var commandsBuffer = List[String]()
commandsBuffer ::= "cmd.exe"
commandsBuffer ::= "/c"
commandsBuffer ::= '"'+vcVarsAll.getAbsolutePath+'"'
commandsBuffer ::= "&&"
otherCommands.foreach(c => commandsBuffer ::= c)
val asArray = commandsBuffer.reverse.toArray
val processOutput = processutils.Proc.executeCommand(asArray,true)
return processOutput

otherCommands is an Array[String], containing the following elements:

  • vcbuild

  • /rebuild

  • path to a .sln file

vcVarsAll contains the path to Visual Studio's vcvarsall.bat. It's path is C:\tools\microsoft visual studio 2005\vc\vcvarsall.bat. The error I receive is: 'c:\Tools\Microsoft' is not recognized as an internal or external command, operable program or batch file..

The processutils.Proc.executeCommand has the following implementation:

def executeCommand(params:Array[String],display:Boolean):(String,String) = {
  val process = java.lang.Runtime.getRuntime.exec(params) 
  val outStream = process.getInputStream
  val errStream = process.getErrorStream
  ...
}

The same code, executed from Java/Groovy works. What am I doing wrong?

A: 

Ok, so I tried all the combinations I could think of. What finally worked was omitting cmd.exe /c from the combo.

Geo