Set up debugging of external commands
authorFrederic Massart <fred@moodle.com>
Mon, 2 Sep 2013 03:01:41 +0000 (11:01 +0800)
committerFrederic Massart <fred@moodle.com>
Mon, 2 Sep 2013 03:10:28 +0000 (11:10 +0800)
lib/commands/behat.py
lib/commands/phpunit.py
lib/scripts.py
lib/tools.py

index 73967f2..4191f2c 100644 (file)
@@ -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
index b051922..fac465e 100644 (file)
@@ -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
index 4281023..a9b3b65 100644 (file)
@@ -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:
index d194abd..6fc7104 100644 (file)
@@ -22,7 +22,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 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)