【发布时间】:2011-06-23 12:29:49
【问题描述】:
我使用 subprocess 模块在 python 中启动应用程序,因此该应用程序出现在根“launchd”下的 Activity Monitor 实用程序中。
cmd = "/usr/bin/sudo -H -u "+ self.getCurrentUserName() + "-P" + +os.path.join(dir, app) + app_args
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
当应用程序通过终端手动启动时,它工作正常,并显示在当前用户“launchd”下。 是否可以在 python 中“启动”当前用户下启动应用程序?
我正在运行 OS X 10.6。
【问题讨论】:
标签: python macos subprocess launchd