Skip to content
Advertisement

Subprocess.call() won’t run kill all, I’m on macOS using python

I am trying to kill an app using killall on macos, but everytime I try to do it, it doesn’t kill the app. I have the right name and all but it still won’t kill the app.

My code:

JavaScript

It returns None and doesn’t kill the program.

Advertisement

Answer

subprocess.call() uses the same function signature as the Popen constructor.
The command executed via Popen needs to be passed in different ways depending on shell argument:

  • shell=True, the command needs to be a string.
  • shell=False,the command needs to be a list.

Examples:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement