diyan / pywinrm

Python library for Windows Remote Management (WinRM)
MIT License
1.06k stars 265 forks source link

Close run_cmd() 's session as soon as the process starts running on remote machine and start executing the next line #340

Open salyas0v opened 2 years ago

salyas0v commented 2 years ago

I'm using the session.run_cmd() to launch a swarm agent on remote machine, the code for which is print("Launching swarm agent") result = sess.run_cmd(f'cd /D D:\\workdir\\utils\\swarm-client && start /max start-swarm-client.bat "{jenkins_config.jenkins_server_url}" {jenkins_config.jenkins_username} {jenkins_config.jenkins_pwd} {name} {vapp_ip_address} -labelsFile={file_path}') print("This part doesn't execute!") Now the command works completely fine and I can see the process running on the remote machine. But on my pc, as long as I don't stop the swarm agent process manually on remote pc, control doesn't go to next line i.e. the line print("This part doesn't execute!") after result. Is there any walkaround to go to the second print when the run_cmd()'s process starts running on remote, start executing the next line after run_cmd(), currently It gets stuck inside of run_cmd() command!

Wd3Curry30 commented 2 years ago

I have the same problem