From b3fcf0f48a9df34f5f647d9b93a15992fb6bbc0e Mon Sep 17 00:00:00 2001 From: Sven Velt Date: Fri, 8 Jan 2010 14:48:12 +0100 Subject: [PATCH] Allow command lines with quotes Until now command lines where split at spaces (" ") but if you want some string arguments including spaces ("-e '220 mail.server.de'") this doesn't work anymore. So now we use "shlex.split()" for this. --- nagixsc_conf2xml.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nagixsc_conf2xml.py b/nagixsc_conf2xml.py index 029fa3f..d1ae4a8 100755 --- a/nagixsc_conf2xml.py +++ b/nagixsc_conf2xml.py @@ -2,6 +2,7 @@ import ConfigParser import optparse +import shlex import subprocess import sys @@ -43,7 +44,7 @@ if options.encoding not in available_encodings(): def exec_check(host_name, service_descr, cmdline): try: - cmd = subprocess.Popen(cmdline.split(' '), stdout=subprocess.PIPE) + cmd = subprocess.Popen(shlex.split(cmdline), stdout=subprocess.PIPE) output = cmd.communicate()[0].rstrip() retcode = cmd.returncode except OSError: -- 2.30.2