Googletest export

Check for a high bit to see if a return value is a signal or an error code in googletest/test.

This is needed because for subprocess under python3 windows, a return value representing a C signal (such as 0x80000003) is represented as a large positive integer rather than a negative one.

PiperOrigin-RevId: 345270460
This commit is contained in:
Abseil Team 2020-12-02 14:08:58 -05:00 committed by vslashg
parent b8c4edf95b
commit 73979ee1b9

View File

@ -289,10 +289,10 @@ class Subprocess:
else: # os.WIFEXITED(ret_code) should return True here.
self._return_code = os.WEXITSTATUS(ret_code)
if self._return_code < 0:
if bool(self._return_code & 0x80000000):
self.terminated_by_signal = True
self.exited = False
self.signal = -self._return_code
self.signal = (~self._return_code & 0x7fffffff) + 1
else:
self.terminated_by_signal = False
self.exited = True