i want to execute this shell command in qt
sudo ./filename.sh
sudo ./filename.sh
To copy to clipboard, switch view to plain text mode
this code executng in terminal,,while in Qprocess i getting error
/bin/sh: 0: Can't open sudo
/bin/sh: 0: Can't open sudo
To copy to clipboard, switch view to plain text mode
my code below:
bool x;
qint8 status;
x
=process.
startDetached("/bin/sh",
QStringList()<<
"sudo "<<
"./samp.sh");
qDebug()<<process.readAllStandardOutput();
status=process.waitForFinished();
if(!x)
{
qDebug()<<process.errorString();
}
else
{
qDebug()<<"success";
}
QProcess process;
bool x;
qint8 status;
x=process.startDetached("/bin/sh", QStringList()<< "sudo "<<"./samp.sh");
qDebug()<<process.readAllStandardOutput();
status=process.waitForFinished();
if(!x)
{
qDebug()<<process.errorString();
}
else
{
qDebug()<<"success";
}
To copy to clipboard, switch view to plain text mode
after searching i got one solution for sudo which wysota said
http://www.qtcentre.org/threads/3962...commands-linux
apath
=QDir("/bin/bash").
absolutePath());
program="gksudo";//i used gksudo i getting no answer
args << "apt-get install";
process->start(program,args);
QString apath,program;
QStringList args;
apath=QDir("/bin/bash").absolutePath());
program="gksudo";//i used gksudo i getting no answer
args << "apt-get install";
process->start(program,args);
To copy to clipboard, switch view to plain text mode
how to use sudo commang in Qprocess please give me suggestion for this
Thanks in advance
Bookmarks