Fix opening Terminal on macOS 13

When Qt Creator is notarized.

Using "open" results in a privacy error. A workaround is to use
osascript. Unfortunately then the terminal window does not close
automatically anymore.

Fixes: QTCREATORBUG-28683
Change-Id: I9861d7bd5100fd28b46b774fa465c970758a3a3f
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Eike Ziller
2023-02-07 15:34:42 +01:00
parent a069ed838e
commit 5c98eaf592

View File

@@ -100,7 +100,13 @@ def main():
shell_script.write(commands) shell_script.write(commands)
shell_script.flush() shell_script.flush()
os.chmod(shell_script.name, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) os.chmod(shell_script.name, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR)
subprocess.call(['/usr/bin/open', '-a', 'Terminal', shell_script.name]) # TODO /usr/bin/open doesn't work with notarized app in macOS 13,
# use osascript instead (QTCREATORBUG-28683).
# This has the disadvantage that the Terminal windows doesn't close
# automatically anymore.
# subprocess.call(['/usr/bin/open', '-a', 'Terminal', shell_script.name])
subprocess.call(['/usr/bin/osascript', '-e', 'tell app "Terminal" to activate'])
subprocess.call(['/usr/bin/osascript', '-e', 'tell app "Terminal" to do script "' + shell_script.name + '"'])
if __name__ == "__main__": if __name__ == "__main__":
main() main()