Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4ba6ca3

Browse files
fix: always open app as logged-in user in postinstall script (#216)
This PR prevents issues like:<img width="428" height="171" alt="Screenshot 2025-07-30 at 3 57 07 pm" src="https://github.com/user-attachments/assets/729055b8-bc9b-43fc-9e95-ed9faa384872" />which occur when the app is launched as root. This can happen when the installer scripts are run as root, which is the case when deploying Coder Desktop over MDM. (As a convenience, we re-open the app if it was open before the installer was ran.)Of note is that on macOS, it is not sufficient to just run open with `sudo -u`, as that does not use the execution context of the user. Seehttps://developer.apple.com/forums/thread/78332Reports of the bug in other programs:(with an incorrect solution)https://community.zoom.com/t5/Zoom-Meetings/A-keychain-cannot-be-found-to-stoer-quot-Zoom-quot/m-p/51059https://displaylink.org/forum/showthread.php?p=97176
1 parent8d9f844 commit4ba6ca3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎pkgbuild/scripts/postinstall‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ spctl -avvv "/Applications/Coder Desktop.app/Contents/Library/SystemExtensions/c
3232
# Restart Coder Desktop if it was running before
3333
if [-f"$RUNNING_MARKER_FILE" ];then
3434
echo"Starting Coder Desktop..."
35-
open -a"Coder Desktop"
35+
# When deploying the app via MDM, this script runs as root. The app cannot
36+
# function properly when launched as root.
37+
currentUser=$(/usr/bin/stat -f"%Su" /dev/console)
38+
/bin/launchctl asuser"$( /usr/bin/id -u"$currentUser")" /usr/bin/open"/Applications/Coder Desktop.app"
3639
rm"$RUNNING_MARKER_FILE"
3740
echo"Coder Desktop started."
3841
fi

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp