-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
durable-task-plugin: 1.36
The added try-catch breaks valid usage of PowerShell param(). param() is required to be the first thing in a script or function so adding the try-catch breaks this.
Mentioned here:
Culprit code:
Running this:
powershell(script: 'param ([string] $abc = "def")')
fails with this error:
[Pipeline] powershell powershell.exe : param : The term 'param' is not recognized as the name of a cmdlet, function, script file, or operable program. Check At C:\Jenkins\durable-a1234567\powershellWrapper.ps1:3 char:1 + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (param : The ter...program. Check :String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError the spelling of the name, or if a path was included, verify that the path is correct and try again. At C:\Jenkins\durable-a1234567\powershellScript.ps1:1 char:7 + try { param ([string] $abc = "def") } catch { throw } + ~~~~~ + CategoryInfo : ObjectNotFound: (param:String) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : CommandNotFoundException
- is duplicated by
-
JENKINS-65597 PowerShell step generates a parse error when starting with [CmdletBinding()]
- Resolved