When I run ksysgruard from a terminal, I found out it doesn't
connect to remote hosts' sensors (tried with localhost, but anyway)
and messes up the terminal (which doesn't show the input
afterwards). This is caused by ssh, which ksysguard uses to connect to
remote host, asking for the password on the terminal. This is super
annoying, because you don't normally expect a GUI application like
ksysguard to ask for anything on the terminal, and also because the
mess up later.
The reason is that nothing changes the controlling terminal when
ksysguard runs ssh, so it inherits the parent's terminal. SSH
normally uses the terminal to get password if it has one. However, it
will use SSH_ASKPASS if it doesn't, which is what we want.
This patch fixes it by running whatever is ran by SensorShellAgent
with setsid, which is an executable from the util-linux package. I've
considered the following alternatives and found this one to be the
- Use QProcess::startDetached. Detaches from the terminal, but has the drawback that this method doesn't allow to interact with input/output or wait for completion, which is what we want.
- Use KPtyProcess: Not possible since while this detaches the ssh process from the parent's terminal, it creates a new one which would cause ssh to ask for password on that terminal. We would have to add code to relay interaction on the terminal to the user.
- Create our own wrapper executable. That would have the advantage that it works on other systems than linux, eg. freebsd.