Skip to content

Commit

Permalink
#1169: ignore access denied error on the agent file, launchctl runs a…
Browse files Browse the repository at this point in the history
…s root - in other cases, print an error to stderr and try to continue anyway

git-svn-id: https://xpra.org/svn/Xpra/trunk@13946 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Oct 1, 2016
1 parent 411699d commit 21b0177
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/xpra/scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2258,8 +2258,13 @@ def start_server_subprocess(script_file, args, mode, defaults, dotxpra,
#launch the shadow server via launchctl so it will have GUI access:
LAUNCH_AGENT = "org.xpra.Agent"
LAUNCH_AGENT_FILE = "/System/Library/LaunchAgents/%s.plist" % LAUNCH_AGENT
if not os.path.exists(LAUNCH_AGENT_FILE):
raise InitException("Error: cannot start shadow,\n the launch agent file '%s' is missing.\n" % LAUNCH_AGENT_FILE)
try:
os.stat(LAUNCH_AGENT_FILE)
except Exception as e:
#ignore access denied error, launchctl runs as root
import errno
if e[0]!=errno.EACCES:
sys.stderr.write("Error: shadow may not start,\n the launch agent file '%s' seems to be missing:%s.\n" % (LAUNCH_AGENT_FILE, e))
argfile = os.path.expanduser("~/.xpra/shadow-args")
with open(argfile, "w") as f:
f.write('["Xpra", "--no-daemon"')
Expand Down

0 comments on commit 21b0177

Please sign in to comment.