【问题标题】:Why Doesn't Applescript Exit After Background Shell Job?为什么Applescript在后台Shell作业后不退出?
【发布时间】:2009-11-21 20:25:42
【问题描述】:

我可以创建一个(非常)简单的 applescript 应用程序来运行 Firefox 后台并退出。 (原因是我有不同的工作和家庭档案)。我的脚本基本上是:

做shell脚本 "/Applications/firefox.app/Contents/MacOS/firefox -no-remote -P '个人' &"

它可以工作,但脚本/应用程序在我退出 Firefox 之前不会退出。我该如何解决?

【问题讨论】:

    标签: applescript


    【解决方案1】:

    您需要将 stdout 和 stderr 重定向到某个地方。 do shell script 命令知道它为程序的 stdout 和 stderr 设置的管道仍然打开,因此它等待它们关闭。

    do shell script "/Applications/firefox.app/Contents/MacOS/firefox -no-remote -P 'Personal' > /dev/null 2>&1 &"
    

    【讨论】:

      猜你喜欢
      • 2020-05-05
      • 2010-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-26
      • 2012-07-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多