【问题标题】:Force exe application to run in foreground in Jenkins/Python强制 exe 应用程序在 Jenkins/Python 的前台运行
【发布时间】:2022-07-19 19:53:42
【问题描述】:

我有一个执行 python 脚本的 Jenkins 作业,并且该 python 脚本调用 IBM Doors。

在 Jenkins 中,python 脚本是这样执行的:

def execute = bat(script: "python -u MyScript.py", returnStdout: true)
echo execute

在 python 脚本中,IBM Doors 是这样启动的:

subprocess.Popen(['pathToDoors\\doors.exe', '-osUser'])
Doors = Dispatch('Doors.Application')

Doors 运行后,我正在使用以下命令执行一些 dxl 脚本:

Doors.runFile('MyScript.dxl')

问题是当我启动 Jenkins 作业时,Doors 总是在后台运行。问题是我看不到 Doors 可能显示的有关 dxl 脚本执行的任何错误消息。 Doors 仅在后台启动,从 Jenkins 执行 python 脚本时没有 GUI。如果我从 Jenkins 从属服务器上的 PowerShell/CommandPrompt 执行该 py,那么 Doors 将使用 GUI 在前台运行。

我的问题是: 当从 Jenkins 执行 python 脚本时,是否可以强制 exe 应用程序在前台运行(使用 GUI)?

【问题讨论】:

    标签: python jenkins ibm-doors background-foreground


    【解决方案1】:

    Jenkins 作业在 Jenkins 运行的任何上下文中运行。这意味着,如果您的 Jenkins 代理作为服务运行,它(以及它启动的任何进程)将在后台运行。

    如果您希望您的作业在前台运行,您需要在前台运行 Jenkins 代理(即作为登录用户),而不是作为服务。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-09-22
      • 2013-02-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多