Plink is not returning to command prompt when executing start_http

泪湿孤枕 提交于 2019-12-12 02:14:07

问题


I'm executing a command using Plink through a Perl file from a Windows machine.

system("cmd /c c:\\plink.exe -batch -ssh -l $user_name @ $host_name  -pw  $pwd start_http");

Execution is hanging. When I execute the same command from command prompt, Plink is not returning to command prompt.

Tried using & at the end of the command but no use. And I don't want to redirect output to any log file.

Whereas "stop" command is working fine

system("cmd /c c:\\plink.exe -batch -ssh -l $user_name @ $host_name  -pw  $pwd stop_http");

回答1:


stdout/err must be detached from the terminal.

So change command to

system("cmd /c c:\\plink.exe -batch -ssh -l $user_name @ $host_name  -pw  $pwd start_http /dev/null 2>&1 &");


来源:https://stackoverflow.com/questions/27798286/plink-is-not-returning-to-command-prompt-when-executing-start-http

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!