Skip to content

Commit bae4eec

Browse files
committed
Catch the exception correctly
1 parent cf916db commit bae4eec

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/test_pe.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
from qiling.os.windows.fncc import *
1717
from qiling.os.windows.utils import *
1818
from qiling.os.mapper import QlFsMappedObject
19+
# This is intended.
20+
# See https://stackoverflow.com/questions/8804830/python-multiprocessing-picklingerror-cant-pickle-type-function
1921
import multiprocess as mb
22+
import traceback
2023

2124
# On Windows, the CPython GC is too conservative and may hold too
2225
# many Unicorn objects (nearly 16GB) until free-ing them which may
@@ -33,7 +36,8 @@ def _run_test(self, results):
3336
try:
3437
results['result'] = self._test()
3538
except Exception as e:
36-
results['exception'] = e
39+
tb = traceback.format_exc()
40+
results['exception'] = tb
3741
results['result'] = False
3842

3943
def run(self):
@@ -45,7 +49,7 @@ def run(self):
4549
if "exception" not in results:
4650
return results['result']
4751
else:
48-
raise results['exception']
52+
raise RuntimeError(f"\n\nGot an exception during subprocess:\n\n{results['exception']}")
4953

5054

5155
class TestOut:

0 commit comments

Comments
 (0)