Exec command failing on some PCs in psake script to OpenCover

Dave Alger

I have been testing running a coverage check of my unit tests using OpenCover and have created a powershell script to create the coverage report using psake.

    Exec { opencover.console.exe -target:"nunit3-console.exe" -targetargs:"Slu.Taxen.Data.Kol.Test.dll" -register:user -output:"..\Coverage\DataTestResults.xml" -filter:"+[*]* -[Slu.Taxen.Data.Kol.Test*]*" }

This has worked without problem on a couple of computers (both running windows 10) but when I tried it today on a windows 8.1 machine I get the error message:

Incorrect Arguments: The argument '-[Slu.Taxen.Data.Kol.Test*]*' is not recognised

and then:

Error: 14/03/2016 16:49:08:
At F:\Code\Greenbase2\KolAPI\psake.psm1:147 char:17 +                 throw ("Exec: " + $errorMessage) +
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [<<==>>] Exception: Exec: Error executing command  opencover.console.exe -target:"nu
nit3-console.exe" -targetargs:"Slu.Taxen.Data.Kol.Test.dll" -register:user 
-output:"..\Coverage\DataTestResults.xml" -f
ilter:"+[*]* -[Slu.Taxen.Data.Kol.Test*]*" .

But if I run the command directly in console on my windows 8.1 machine it works fine. Which suggests to me that it's not opencover which is causing the fuss but Psake or powershell.

Any clues?

Shaun Wilde

We found that with powershell that putting the quotes around the whole argument works better when passing any argument that contains spaces when in powershell - see usage wiki e.g. Instead of

-filter:"<filters with spaces>"

Do

"-filter:<filters with spaces>"

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

kubectl exec command failing with: Upgrade request required

expect command in bash script failing

`{} {}some` vs`{} {,some}` in the `-exec` option of the `find` command

Why is my exec command failing but works if the command is passed in the terminal?

Bash script using mysql command with variables failing

Sed command failing with bad flag in script

Docker exec command in entrypoint script fails

need to "build" a mysql command and exec it in a shell script

PHP script hangs after exec command

How to pass variable to exec command in expect script?

Google sheet =getId() script failing for some copied sheets

SFTP Manual command succeed but script is failing at 1 or 2%

What is to be done to fix Git log command failing from a Bitrise script

Docker exec: ipconfig failing

WPF application does not run on some PCs

Invalid key name for REG ADD on some PCs

PHP script stuck on exec even after running command in backgroud on Windows

Unable to exit shell script when using exec command

'exec' command blocks the running of php script when execute SchTasks

Ant script: Have <exec> tag dump out entire command line

How to use Linux "find" with "-exec" command within an ANT script?

Read input from command line into the shell script exec using golang

How to execute Mysql Script in golang using exec.Command

When I exec a script with command "at", I get an infinite loop

Running docker exec command with a shell string and parameters in bash script

How to run exec bash command from the bash script in Linux (ubuntu)?

Mysql PDO, query exec is failing

Match Exec failing to execute anything

Some Unix commands fail with "<command> not found", when executed using Python Paramiko exec_command