Solved QProcess is not running for some programs in linux..
-
Hello ,
i'm using the following snippet and it doesn't work.. Does someone experience the same issue ? the
rm
command works as expected.. Alsoprocess.errorString()
returns "unknown error"QProcess process; const QString sed = "/usr/bin/sed" ; const QString ed = "'s/"+esc_username+":.*$//'"; const Qstring option = "-i"; const QString shadowpath = "/etc/shadow"; QStringList arguments ; arguments << option << ed << shadowpath ; process.start(sed, arguments); process.waitForStarted(); process.waitForFinished(); arguments.clear();
-
and it doesn't work.
Put in error handling for all
QProcess
code, including reading any standard error output.For a start, the
sed
could find youresc_username
content unacceptable. What is in it when it goes wrong? -
@xenovas said in QProcess is not running for some programs in linux..:
const QString ed = "'s/"+esc_username+":.*$//'";
The single quotes are wrong
-
The single quotes are wrong
Indeed. It might help the OP if you commented that they should not be there at all! :)
-
@Christian-Ehrlicher @JonB hmm.. same problem again and again.. -- tha quotes -- .. thanks guys :)
-
Hi,
Unless you run it as root, it won't work because the file you are trying to modify is not accessible to standard users.
-
@SGaist it runs with root privs thanks