I have a Jenkins triggered project which has the following command wrapped in a PHP exec -
$dos2unix = exec("dos2unix ".$filePath);
It shows the following unwanted command output in the Jenkins console output and clutters the screen -
dos2unix: converting file /home/jenkins/deployment_beta/phing/scratchpad/adserver/app/webroot/openx/lib/OA/Dal/Delivery/mysql.php to UNIX format ...
dos2unix: converting file /home/jenkins/deployment_beta/phing/scratchpad/adserver/app/webroot/openx/lib/OA/Dal/Maintenance/Statistics/Common.php to UNIX format ...
I tried wrapping the command in an ob_start() and ob_end_clean() and also directed the output to /dev/null -
ob_start();
$dos2unix = exec("dos2unix ".$filePath." > /dev/null");
ob_end_clean();
But, I am still getting the same in console output.
Note - If I trigger the build manually in command line, I do not see this undesired output, regardless of whether I have directed the output to /dev/null or wrapped in output buffer statements.
I have read Suppressing output from exec() calls in PHP but could not solve the problem.