Home > database >  How to make Jenkins accept bat command ends with "Press any key to continue..." as success
How to make Jenkins accept bat command ends with "Press any key to continue..." as success

Time:08-02

Currently I'm writing a Jenkins pipeline, in which there are lots of batch scripts that ends with "Press any key to continue...". The problem is that when Jenkins run those scripts it counted that line as failure (return 1) and the build aborts. I tried to make the pipeline accept the return 1 as success but when the scripts failed to run it also returns 1 and Jenkins cannot tell the differences between the two.

I cannot remove that line because we still have to manually build the project sometimes. How can I modify either the Jenkin script or the batch script that accept that "press any key to continues..." line as success without changing how the batch script work when ran manually?

Thank you.

CodePudding user response:

As @Mofi mentioned, you'll need to set the execution directory the same as the script directory using dir ("""${trunk}\""")

  • Related