I'm trying to find a way to check the existence of a shell command before its execution.
For example, I'll execute the command ack-grep. So, I'm trying to do:
from subprocess import PIPE
cmd_grep = subprocess.Popen(["ack-grep", "--no-color", "--max-count=1", "--no-group", "def run_main", "../cgedit/"], stdout=PIPE, stderr=PIPE)
Than, if I execute
I receive '' like the output. But I don't have the command ack-grep on my path. So, why Popen is not putting the error message on my .stderr variable?
Also, is there a easyer way to do what I'm trying to do?