简体   繁体   中英

Nested remote process started by QProcess remains as zombie

I am tailing the logs on my log server to display any of them in a window, however when I close my application, the remote tail process remains active on the server.

Repeating produces a huge amount of zombie processes.

process_log_watcher_->start(QString(
      "ssh -t %1 \"tail -F -n 0 /var/log/logfile.log\"").arg(log_server_));

In a console, the ssh -t option handles an exit of the terminal; I want to reproduce that behaviour.

In the destructor I call process_log_watcher_->close(); , but it does not seem to help. It behaves differently from closing a console window with the ssh -t server "tail -F -n 0 /var/log/logfile.log" started.

Could it be that the QProcess does not terminate the ssh session?

ssh -t server bash -c \\"tail -F -n 0 /var/log/logfile.log\\" solves the problem.

That means that the ssh connection termination is not properly forwarded to the tail, but it is correctly forwarded to the remote bash, which then terminated the tail as required.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM