Jérôme G
Jérôme G

Reputation: 1126

How to hide script name using returnStdout in Jenkins?

In my JenkinsFile I execute a python script like this :

def TEST = bat (script: '''
                %PYTHON% .\\setVersion.py --path=%WORK_DIR% --version=%RELEASE_NAME% --major=%SRC_VERSION%
                ''', returnStdout: true)
echo "The script displays : ${TEST} and it is wonderful !"

This works pretty well except that my ${TEST} variable contains the script name :

The script displays : 
w:\root\build>C:\Tools\Python\2.7\python.exe .\setVersion.py --path=w:/root/build --version=guava --major=1.3 
The version will be : guava-1.3.7272
 and it is wonderful !

I would like it to display something like this :

The script displays : The version will be : guava-1.3.7272 and it is wonderful !

I don't know how to do it, I would appreciate some help !

Upvotes: 1

Views: 507

Answers (1)

daggett
daggett

Reputation: 28599

add @echo off at the beginning of script

def TEST = bat (script: '''@echo off
                %PYTHON% .\\setVersion.py --path=%WORK_DIR% --version=%RELEASE_NAME% --major=%SRC_VERSION%
                ''', returnStdout: true)
...

Upvotes: 3

Related Questions