问题描述
通常,如果我在命令行上,这只是检查%errorlevel%返回的简单过程。但是,当我在管道上时,无论findstr是否找到该字符串,它都会始终返回0。就字符串是否有空格的问题,我尝试了不同的组合,但这根本没有帮助。这是我一直在管道脚本中尝试在Jenkins上使用的代码。
findme = "youFailed"
theReturnValue = bat(script: "findstr /C:${findme} output.txt,"returnStatus: true)
echo "${theReturnValue}" //doesn't even get executed for some reason but if I change the value to a string that has space inside of it but doesnt exist then it prints out 0
我当然也尝试过bat "findstr /C:${findme} output.txt"
,但没有任何改变。打印出来的0使我认为它代表正在调用的命令,但就是否能够找到字符串而言,实际上并没有真正获得该命令的实际结果。考虑到它很容易在命令行上执行,我认为这在詹金斯中应该是基本的工作,但在获取返回值方面需要一些建议
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)