admin管理员组

文章数量:1122816

I have installed Jenkins as a service on my windows 10 computer. Jenkins connects via SSH to the machine.

The pipeline script looks like this:

timestamps {
    node('abc') {
        stage("exec") {
            bat """
                echo 'script start'
                D:\\tools\\python\\python.exe D:\\test_dir\\test_script.py
                echo 'script end'
            """
        }
    }
}

The python script is getting triggered. In the python script I am calling a program via subprocess.Popen(). For example MS Edge:

proc = subprocess.Popen(['C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe'])
print(f"{proc.pid=}")
time.sleep(60)  # sleep for a minute

The subprocess gets created and the pid is printed to the console. But Edge does not open... also in the Task Manager the process is not showing up.

I tried launching the python script locally and it worked. Is there any better way to do this than with subprocess.Popen() ?

I think it has something to do with windows sessions ans processes, but I have no idea how exactly they work.

本文标签: pythonstart a program via Jenkins serviceStack Overflow