From 7184c1c089029626ec79736f143005e580eaaabd Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Mon, 2 Sep 2013 11:01:41 +0800 Subject: [PATCH] Set up debugging of external commands --- lib/commands/behat.py | 1 - lib/commands/phpunit.py | 1 - lib/scripts.py | 2 -- lib/tools.py | 3 ++- 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/commands/behat.py b/lib/commands/behat.py index 73967f2..4191f2c 100644 --- a/lib/commands/behat.py +++ b/lib/commands/behat.py @@ -227,7 +227,6 @@ class BehatCommand(Command): sleep(3) # Running the tests - logging.info('Executing %s', cmd) process(cmd, M.path, None, None) # Kill the remaining processes diff --git a/lib/commands/phpunit.py b/lib/commands/phpunit.py index b051922..fac465e 100644 --- a/lib/commands/phpunit.py +++ b/lib/commands/phpunit.py @@ -113,7 +113,6 @@ class PhpunitCommand(Command): if args.unittest: cmd.append(args.unittest) cmd = ' '.join(cmd) - logging.info('Executing %s', cmd) process(cmd, M.get('path'), None, None) except Exception as e: raise e diff --git a/lib/scripts.py b/lib/scripts.py index 4281023..a9b3b65 100644 --- a/lib/scripts.py +++ b/lib/scripts.py @@ -131,7 +131,6 @@ class Scripts(object): shutil.copyfile(cli, dest) cmd = '%s %s' % (C.get('php'), dest) - logging.debug('Executing %s' % (cmd)) result = process(cmd, cwd=path, **cmdkwargs) os.remove(dest) elif cli.endswith('.sh'): @@ -141,7 +140,6 @@ class Scripts(object): os.chmod(dest, stat.S_IRUSR | stat.S_IXUSR) cmd = '%s' % (dest) - logging.debug('Executing %s' % (cmd)) result = process(cmd, cwd=path, **cmdkwargs) os.remove(dest) else: diff --git a/lib/tools.py b/lib/tools.py index d194abd..6fc7104 100644 --- a/lib/tools.py +++ b/lib/tools.py @@ -22,7 +22,6 @@ along with this program. If not, see . http://github.com/FMCorz/mdk """ -import sys import os import signal import subprocess @@ -30,6 +29,7 @@ import shlex import re import threading import getpass +import logging def yesOrNo(q): @@ -105,6 +105,7 @@ def parseBranch(branch, pattern): def process(cmd, cwd=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE): if type(cmd) != list: cmd = shlex.split(str(cmd)) + logging.debug(' '.join(cmd)) proc = subprocess.Popen(cmd, cwd=cwd, stdout=stdout, stderr=stderr) (out, err) = proc.communicate() return (proc.returncode, out, err) -- 2.11.0