Powershell script path with whitespace fails quietly

I just lost some time debugging what was going on with my powershell script, run via Powershell action.
I found the problem but I think this could be fixed easily.

The problem was that I added, by mistake, space after script name.
This cause the script to “run”, with no output, with no error message, no output and exited with 0.
I am guessing that it did not run the script at all.

I think easiest fix would be to trim the script path in this action or at least log that something went wrong.

Hi Michal,

We’ve just tested adding a space to the end of the “Script File (.ps1 file)” field value. When saving this displays a validation error “Script File (.ps1 file) must have the extension: .ps1”. So, I just want to check that you are referring to this field in the Continua CI PowerShell action and that you have the latest version installed.

Nevertheless, we have now added some code for the next release which trims spaces from the Script File field value for this action.

Yes, powershell action. I get not validation error. I am using version 1.9.2.1106

OK, the reason it’s not showing the validation error is due to the expression. The value is trimmed when validating a value containing an expression. The next release will ensure that spaces are trimmed from path fields in all actions before validation and execution. Thanks for reporting this.

1 Like