From 2ef4751c25fbbced996deed6e17bd5bae7a5fdd7 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sat, 7 Feb 2015 12:18:59 +0100 Subject: [PATCH] TaskWarrior: Add keyword argument to supress failure in execute_command --- tasklib/task.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasklib/task.py b/tasklib/task.py index 73280b0..2a51b35 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -777,14 +777,14 @@ class TaskWarrior(object): stdout, stderr = [x.decode('utf-8') for x in p.communicate()] return stdout.strip('\n') - def execute_command(self, args, config_override={}): + def execute_command(self, args, config_override={}, allow_failure=True): command_args = self._get_command_args( args, config_override=config_override) logger.debug(' '.join(command_args)) p = subprocess.Popen(command_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = [x.decode('utf-8') for x in p.communicate()] - if p.returncode: + if p.returncode and allow_failure: if stderr.strip(): error_msg = stderr.strip().splitlines()[-1] else: -- 2.39.2