QProcess, osascript, and administrator privileges
Unsolved
General and Desktop
-
Re: MacOS: how to run AppleScript script from a Qt app?
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?