The console output is different for the 2 scripts below - depending on if 'returnStdout: true' is used or not. The second script does it right, the first - where 'returnStdout: true' is used - does it wrong. I'm quite sure that the first script also worked correctly 2 months or so ago.
pipeline {
agent any
stages {
stage('Test') {
steps {
script {
stdo = powershell(returnStdout: true, script: '''
Write-Host "Will there be a newline after me? " -NoNewLine
Write-Host "Yes! -> Unfortunately!"
''')
}
script {
powershell(script: '''
Write-Host "Will there be a newline after me? " -NoNewLine
Write-Host "No! -> Great!"
''')
}
}
}
}
}
The console output is different for the 2 scripts below - depending on if 'returnStdout: true' is used or not. The second script does it right, the first - where 'returnStdout: true' is used - does it wrong. I'm quite sure that the first script also worked correctly 2 months or so ago.
{code:java}
pipeline { agent any stages { stage('Test') { steps { script { stdo = powershell(returnStdout: true, script: ''' Write-Host "Will there be a newline after me? " -NoNewLine Write-Host "Yes! -> Unfortunately!" ''') } script { powershell(script: ''' Write-Host "Will there be a newline after me? " -NoNewLine Write-Host "No! -> Great!" ''') } } } } }
Yes! -> Unfortunately! [Pipeline] } [Pipeline] // script [Pipeline] script [Pipeline] { [Pipeline] powershell Will there be a newline after me? No! -> Great!
[Pipeline] } [Pipeline] // script [Pipeline] }
[Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: SUCCESS{noformat}