How to gently kill Firefox process on Linux/OS X

前端 未结 7 1425
盖世英雄少女心
盖世英雄少女心 2021-02-08 06:02

I\'m doing some automation with Firefox and although I can open Firefox window from shell, I\'m not able to terminate it properly. If I kill Firefox process with

7条回答
  •  无人及你
    2021-02-08 06:29

    In Mac OS X, you could use AppleScript to close it (adjust the application name as necessary; I don't have FireFox installed to test):

    $ osascript -e 'tell application "FireFox"
    quit
    end tell'
    

    This should trigger the same event that the Quit menu command triggers, so FireFox should shut down cleanly.

    Obviously, this won't work in Linux.

提交回复
热议问题