从 plasmoid 执行特定命令

发布于 2024-10-05 13:22:06 字数 424 浏览 0 评论 0原文

我正在编写一个远程控制 Plasmoid,我希望它通过 ssh 向远程主机发送某些命令,我​​已经尝试过了:

QProcess p;
p.start("/home/user/bin/command");
p.waitfForFinished(-1);

其中 command 是一个脚本,

#!/bin/bash
ssh user@remote_host remote_command &> /dev/null &

我也尝试过使用

KRun::run(QString("/home/user/bin/command"), NULL);

它,但它什么也没做,也许我使用它的方式错误? 有什么建议吗?

I'm writing a Remote Control Plasmoid, I want it to send certain commands over ssh to a remote host, I've tried:

QProcess p;
p.start("/home/user/bin/command");
p.waitfForFinished(-1);

where command is a script which has

#!/bin/bash
ssh user@remote_host remote_command &> /dev/null &

I've also tried using

KRun::run(QString("/home/user/bin/command"), NULL);

but it does nothing, perhaps I'm using it the wrong way?
Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

彼岸花ソ最美的依靠 2024-10-12 13:22:06

好的,我的问题是我没有正确连接信号,现在我已经做到了,并且这部分代码工作完美。

此致!

OK, my problem was that I didn't connect the signals correctly, now I've done that and this part of code works perfectly.

best regards!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文