问题
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