Skip to content

Commit 72d9acb

Browse files
Slamdunksebastianbergmann
authored andcommitted
PatchCoverageCommand: use specific exit codes for errors and failures
1 parent 4dcabbb commit 72d9acb

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/cli/PatchCoverageCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function run(Arguments $arguments): int
2323
$arguments->coverage()
2424
);
2525

26-
return 1;
26+
return 255;
2727
}
2828

2929
if (!is_file($arguments->patch())) {
@@ -32,7 +32,7 @@ public function run(Arguments $arguments): int
3232
$arguments->patch()
3333
);
3434

35-
return 1;
35+
return 255;
3636
}
3737

3838
$pathPrefix = $arguments->pathPrefix() ?: '';
@@ -53,7 +53,7 @@ public function run(Arguments $arguments): int
5353
print 'Are you sure your --path-prefix is correct?' . PHP_EOL;
5454
}
5555

56-
return 1;
56+
return 2;
5757
}
5858

5959
printf(

tests/end-to-end/patch-coverage/invalid-first-argument.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ var_dump((new SebastianBergmann\PHPCOV\Application)->run($_SERVER['argv']));
1515
phpcov %s by Sebastian Bergmann.
1616

1717
Code Coverage file "does-not-exist" does not exist
18-
int(1)
18+
int(255)

tests/end-to-end/patch-coverage/invalid-second-argument.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ var_dump((new SebastianBergmann\PHPCOV\Application)->run($_SERVER['argv']));
1515
phpcov %s by Sebastian Bergmann.
1616

1717
Patch file "does-not-exist" does not exist
18-
int(1)
18+
int(255)

tests/end-to-end/patch-coverage/valid-arguments-with-invalid-path-prefix.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ phpcov %s by Sebastian Bergmann.
1818

1919
Unable to detect executable lines that were changed.
2020
Are you sure your --path-prefix is correct?
21-
int(1)
21+
int(2)

tests/end-to-end/patch-coverage/valid-arguments-without-path-prefix.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ phpcov %s by Sebastian Bergmann.
1616

1717
Unable to detect executable lines that were changed.
1818
Are you sure you do not need to use --path-prefix?
19-
int(1)
19+
int(2)

0 commit comments

Comments
 (0)