Skip to content

Commit 97b287a

Browse files
committed
Wrap the task status as a signed short if it's low
That makes it map git error status to their real value
1 parent 627c902 commit 97b287a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Classes/Util/PBTask.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,13 @@ - (void)performTaskOnQueue:(dispatch_queue_t)queue terminationHandler:(void (^)(
122122
NSString *desc = @"Task exited unsuccessfully";
123123
NSArray *taskArguments = [@[task.launchPath] arrayByAddingObjectsFromArray:task.arguments];
124124
NSString *failureReason = [NSString stringWithFormat:@"The task \"%@\" returned a non-zero return code", [taskArguments componentsJoinedByString:@" "]];
125+
int status = task.terminationStatus;
126+
NSNumber *terminationStatus = (status < 255 ? [NSNumber numberWithShort:(short)status] : @(status));
127+
125128
NSDictionary *userInfo = @{
126129
NSLocalizedDescriptionKey: desc,
127130
NSLocalizedFailureReasonErrorKey: failureReason,
128-
PBTaskTerminationStatusKey: @(task.terminationStatus),
131+
PBTaskTerminationStatusKey: terminationStatus,
129132
PBTaskTerminationOutputKey: outputString,
130133
};
131134
error = [NSError errorWithDomain:PBTaskErrorDomain code:PBTaskNonZeroExitCodeError userInfo:userInfo];

0 commit comments

Comments
 (0)