Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jenkins: how to capture stderr output

In jenkins, you can run a script with sh(). There is an options to returnStdout, which will send stdout to a return value, rather than printing it to the console.

Is it possible to capture stderr in any way? Whether through an option to the function or through some workaround?

like image 855
ewok Avatar asked Jan 23 '18 15:01

ewok


1 Answers

Generally, you can redirect a process's STDERR to STDOUT with 2>&1 and collect both.

There's no other way but this redirection workaround at the moment, see https://issues.jenkins-ci.org/browse/JENKINS-44930

like image 164
mghicks Avatar answered Sep 20 '22 07:09

mghicks