Skip to content

Commit 20131d3

Browse files
committed
Fix Phabricator's --trace command
Fixes #405
1 parent 0609517 commit 20131d3

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

apis/phabricator.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ def submit_to_phabricator(rev_id, retry_attempt=None):
4949
cmd.append(rev_id)
5050
cmd.append("--")
5151

52-
ret = self.run(cmd)
52+
ret = self.run(cmd, clean_return=False)
53+
if ret.returncode == 255 and retry_attempt > 1:
54+
pass # --trace results in this return code
55+
else:
56+
ret.check_returncode()
57+
5358
output = ret.stdout.decode()
5459

5560
phab_revision = False

tests/functionality_all_platforms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ def phab_submit(cmd):
709709
raise Exception("No worky!")
710710
if "--trace" not in cmd:
711711
raise Exception("Expected to see --trace in the phabricator command")
712-
return ARC_OUTPUT % (83000 + 50, 83000 + 50)
712+
return (255, ARC_OUTPUT % (83000 + 50, 83000 + 50))
713713

714714
library_filter = 'dav1d'
715715
(u, expected_values, _check_jobs) = self._setup(

tests/mock_commandprovider.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ def run(self, args, shell=False, clean_return=True):
7272

7373
if stdout is None:
7474
self.logger.log("We did not find a mapped response for the command `%s`." % argument_string, level=LogLevel.Warning)
75+
76+
def check_returncode():
77+
if returncode != 0:
78+
raise subprocess.CalledProcessError(returncode, argument_string)
79+
pass
7580
return Struct(**{'stdout':
7681
Struct(**{'decode': lambda: stdout}),
77-
'returncode': returncode})
82+
'returncode': returncode,
83+
'check_returncode': check_returncode})

0 commit comments

Comments
 (0)