File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -423,7 +423,7 @@ def get_readelf_version():
423423 version , stderr = proc .communicate ()
424424
425425 if proc .returncode :
426- raise Exception (
426+ raise AssertionError (
427427 f"Command { ' ' .join (cmd )!r} failed "
428428 f"with exit code { proc .returncode } : "
429429 f"stdout={ version !r} stderr={ stderr !r} "
@@ -464,13 +464,21 @@ def get_readelf_output(self):
464464 command = ["readelf" , "-n" , binary ]
465465 # Force the C locale to disable localization.
466466 env = dict (os .environ , LC_ALL = "C" )
467- stdout , _ = subprocess .Popen (
467+ proc = subprocess .Popen (
468468 command ,
469469 stdout = subprocess .PIPE ,
470470 stderr = subprocess .STDOUT ,
471471 universal_newlines = True ,
472472 env = env ,
473- ).communicate ()
473+ )
474+ with proc :
475+ stdout , _ = proc .communicate ()
476+
477+ if proc .returncode :
478+ raise AssertionError (
479+ f"Command { ' ' .join (command )!r} failed "
480+ f"with exit code { proc .returncode } : stdout={ stdout !r} "
481+ )
474482 return stdout
475483
476484 def test_check_probes (self ):
You can’t perform that action at this time.
0 commit comments