简体   繁体   中英

running apt-get by using Qt (QProcess)

I want to install and run some shell script by using Qt and make a Ubuntu Desktop Application. now I use:

QProcess process;
process.startDetached("bash /home/root_enable");
process.waitForFinished(-1);

But I don't see terminal to enter Y/n and other command. How can I fix this problem?

my root_enable is:

sudo apt-get install vim

QProcess inherits QIODevice . You can use any of its write methods to write to the input stream of the process.

Connect to readyReadStandardOutput signal of the process. In the handler read standard output, parse it and decide what to answer if needed.

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