【发布时间】:2011-10-15 15:10:13
【问题描述】:
我有一个守护进程,在 Mac 上使用 launchd 设置。守护进程以 root 身份运行。以下行不会启动我的 UI 应用程序 -
system("launchctl start com.project.myproj");
但是如果我去终端运行相同的命令 -> launchctl start com.project.myproj。它启动我的应用程序。我的问题是我做错了什么还是系统行为不正确?
【问题讨论】:
我有一个守护进程,在 Mac 上使用 launchd 设置。守护进程以 root 身份运行。以下行不会启动我的 UI 应用程序 -
system("launchctl start com.project.myproj");
但是如果我去终端运行相同的命令 -> launchctl start com.project.myproj。它启动我的应用程序。我的问题是我做错了什么还是系统行为不正确?
【问题讨论】:
问题是系统启动的启动守护进程无法访问 Aqua,因此您的守护进程无法访问桌面环境。
Apple 的Technical Note TN2083: Daemons and Agents 描述了其中的一些内容。 (见this section on launchd agents。)
有人问了similar question about accessing the Aqua environment from an SSH connection。
我猜你需要重新设计你的应用程序:
【讨论】: