Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QProcess, osascript, and administrator privileges
wesblake last edited by wesblake
Hello. I'm trying to build in an app updater. We want to download and run pkg's as store for later connection to store (so we can move our app when we're off webkit)
Here's the code:
QString aScript = "do shell script quot;installer -verbose -store -pkg "+filePath+" -target /quot;" " with administrator privileges"; QString osascript = "sudo /usr/bin/osascript"; QStringList processArguments; processArguments << "-e" << "do shell script \"installer -verbose -store -pkg "+filePath+" -target /\" with administrator privileges"; QProcess p; p.start(osascript, processArguments); //p.write(aScript.toUtf8()); p.closeWriteChannel(); p.waitForFinished(); //int retVal = QProcess::execute("osascript", QStringList() << "-e" << "do shell script \"sudo installer -verbose -store -pkg "+filePath+" -target /\" with administrator privileges"); //if(retVal>-1) //slotReboot();
As you can see, I've tried a couple different ways. The issue is this actually works great when I run the app from Xcode/Qt Creator. However, when I archive and install the signed app, it just stops at this command and never shows the gui prompt for password. Ideas?
wesblake last edited by
Not sure how to mark solved, but I solved it. It was sandboxing that was preventing anything sudo to run. Turned off sandbox and it works fine. :)
On the first post, under it, there is a button called Topic tools. it has the Solved menu.