If the Powershell step is configured with 'returnStdout: true' and the script does not produce output, than [IO.File]::WriteAllLines fails when converting the temporaryOutput.txt, this causes the job to hang:
[jaredtest] Running PowerShell script
Cannot contact : java.nio.file.NoSuchFileException: D:\Jenkins-Windows\workspace\jaredtest@tmp\durable-4fe85a3b\output.txt
Pipeline script to recreate:
node{
def output = powershell(returnStdout: true, script: '')
echo output
}
Executing `powershellWrapper.ps1` directly in the workspace results in the following error:
PS H:\> D:\Jenkins-Windows\workspace\jaredtest@tmp\durable-4fe85a3b\powershellWrapper.ps1
Exception calling "WriteAllLines" with "2" argument(s): "Value cannot be null.
Parameter name: contents"
At D:\Jenkins-Windows\workspace\jaredtest@tmp\durable-4fe85a3b\powershellWrapper.ps1:1 char:585
+ ... utput.txt"; [IO.File]::WriteAllLines("D:\Jenkins-Windows\workspace\ja ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentNullException