Jenkins无法运行exe批处理命令? [英] Jenkins cannot run exe batch commands?

查看:1392
本文介绍了Jenkins无法运行exe批处理命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最终尝试运行某些NUnit网络测试,但是我发现Jenkin的运行会在运行批处理命令path\to\nunit.exe之前停止.因此,我只是尝试运行一个包含单个构建步骤的新作业:执行Windows批处理命令C:\Windows\system32\calc.exe.这是我的控制台输出:

Ultimately trying to run some NUnit web tests, but I found that Jenkin's would stop before running the batch command path\to\nunit.exe. So I just tried running a new job that consists of a single build step: Execute Windows batch command C:\Windows\system32\calc.exe. Here is my console output:

由匿名用户启动

Started by user anonymous

在工作空间C:\ Program Files(x86)\ Jenkins \ jobs \ [我的工作] \ workspace中构建 [工作区] $ cmd/c调用C:\ Windows \ TEMP \ hudson8921839713501090632.bat

Building in workspace C:\Program Files (x86)\Jenkins\jobs\[my job]\workspace [workspace] $ cmd /c call C:\Windows\TEMP\hudson8921839713501090632.bat

C:\ Program Files(x86)\ Jenkins \ jobs \ [我的工作] \工作区> C:\ Windows \ system32 \ calc.exe

C:\Program Files (x86)\Jenkins\jobs\[my job]\workspace>C:\Windows\system32\calc.exe

,它一直挂着,直到我断掉为止.不用说,此命令在命令提示符下运行良好.另外,未打开新进程的命令在Jenkins中运行良好(例如,dir).我不知道在cmd.exe中运行批处理命令与通过Jenkins运行它们之间有什么区别.我无法通过Google搜索jenkins cannot open exe找到任何与远程相关的信息.任何建议表示赞赏.

and there it hangs until I cut if off. Needless to say, this command runs fine in command prompt. Also, commands that do not open new processes run fine (e.g. dir) in Jenkins. I don't know what the difference is between running batch commands in cmd.exe and running them through Jenkins. I cannot find any remotely relevant information with a google search of jenkins cannot open exe. Any advice is appreciated.

在实践Shiva的建议时,我在执行詹金斯(Jenkins)工作时尝试观察正在运行的过程.如果我没有在命令前加start,则calc.exe会运行,但不会显示该界面.一旦我杀死詹金斯的工作,计算器也将被杀死.如果我确实包含start,则除了jenkins作业自己完成并且作业结束后计算器继续运行之外,其他所有内容都相同.这是新的日志:

While practicing Shiva's suggestion, I tried observing the running processes while I ran my Jenkins job. If I do not precede the command with start, then calc.exe does run but the interface does not display. Once I kill the jenkins job, calculator is killed as well. If I do include start, then everything is the same except the jenkins job finishes on its own and the calculator continues to run after the job is over. Here is the new log:

由匿名用户启动 在工作空间C:\ Program Files(x86)\ Jenkins \ jobs \ First Job \ workspace中构建 [工作区] $ cmd/c调用C:\ Windows \ TEMP \ hudson8285328547956378876.bat

Started by user anonymous Building in workspace C:\Program Files (x86)\Jenkins\jobs\First Job\workspace [workspace] $ cmd /c call C:\Windows\TEMP\hudson8285328547956378876.bat

C:\ Program Files(x86)\ Jenkins \ jobs \ First Job \ workspace> 开始 C:\ Windows \ system32 \ calc.exe

C:\Program Files (x86)\Jenkins\jobs\First Job\workspace>start C:\Windows\system32\calc.exe

C:\ Program Files(x86)\ Jenkins \ jobs \ First Job \ workspace>退出0 处理泄漏的文件描述符.参见 http://wiki.jenkins-ci.org/display /JENKINS/Spawning + processes + from + build 了解更多信息 完成:成功

C:\Program Files (x86)\Jenkins\jobs\First Job\workspace>exit 0 Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information Finished: SUCCESS

尽管这是不同的行为,但我不确定它是否会提供进一步的启示.为什么我不能与正在运行的进程进行交互?

Although this is different behavior, I'm not sure that it offers further enlightenment. Why can I not interact with the running processes?

可能相关: Jenkins无法正确执行来自.bat

推荐答案

您不能通过作为服务运行的Jenkins打开Windows进程.您必须通过控制台命令java -jar "C:\Program Files (x86)\Jenkins\jenkins.war" --httpPort=[your desired available port number]运行Jenkins.然后,当Jenkins在您的控制台中运行时,您应该能够在localhost:[您的端口号]的浏览器中对其进行访问.现在,您可以继续打开计算器以及所需的任何其他可执行文件.

You cannot open windows processes through Jenkins running as a service. You have to run Jenkins through the console command java -jar "C:\Program Files (x86)\Jenkins\jenkins.war" --httpPort=[your desired available port number]. Then, while Jenkins is running in your console, you should be able to access it in a browser at localhost:[your port number]. Now you may go forth and open calculators and whatever other executables you want.

https://wiki.jenkins-ci.org/display/JENKINS/Starting + and + Accessing + Jenkins

这篇关于Jenkins无法运行exe批处理命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆