I am writing the following command in jenkinsfile which is running it in the powershell on the server.
\\check_pycodestyle.bat 2>&1 | tee pycodestyle.log; if ($LASTEXITCODE -ne 0) {Write-Output "it worked again"}
It works fine when I run it in my local powershell. But, when I tried to run it on server environment with a jenkinsfile (after modifying ${LASTEXITCODE}
) it is giving me following error.
groovy.lang.MissingPropertyException: No such property: LASTEXITCODE for class: groovy.lang.Binding
Any idea why this happens?