Forum Discussion

kenjliang's avatar
kenjliang
Regular Visitor
2 years ago

double quotes are added to command incorrectly

I have a command that can be run successfully in command line window, see attached command.jpg.

 

Now I want to run it from ReadyAPI groovy step, here is my code:

 

 

def cmd = 'dotnet test --collect:"XPlat Code Coverage"'
log.info(('cmd /c echo ' + cmd).execute().text)
def reader = new BufferedReader (new InputStreamReader(cmd.execute().getInputStream()))
while ((line = reader.readLine()) != null) {log.info(line)}

 

 

I got "MSBUILD : error MSB1008: Only one project can be specified.", please see the attached output.jpg.

Looks like it is because the double quotes in my command had been messed up by some auto adding extra double quotes as well as escaping my original ones, therefore making the one "XPlat Code Coverage" piece became 3 pieces.

 

How to disable the auto escape and keep my command as is?

 

Thank you,

Ken

 

No RepliesBe the first to reply