@@ -284,7 +284,8 @@ def _dump(self) -> Optional[Path]:
284284 logger .error ("PyPerf process is not running" )
285285 return None
286286 else :
287- self .process .send_signal (self ._DUMP_SIGNAL )
287+ if self .process is not None :
288+ self .process .send_signal (self ._DUMP_SIGNAL )
288289
289290 try :
290291 # important to not grab the transient data file - hence the following '.'
@@ -300,10 +301,14 @@ def _dump(self) -> Optional[Path]:
300301 process = self .process # save it
301302 exit_status , stderr , stdout = self ._terminate ()
302303 assert exit_status is not None , "PyPerf didn't exit after _terminate()!"
303- assert isinstance (process .args , list ) and all (
304- isinstance (s , str ) for s in process .args
305- ), process .args # mypy
306- raise PythonEbpfError (exit_status , process .args , stdout , stderr )
304+ if process is not None :
305+ assert isinstance (process .args , list ) and all (
306+ isinstance (s , str ) for s in process .args
307+ ), process .args # mypy
308+ cmd_args : List [str ] = list (process .args ) # type: ignore
309+ else :
310+ cmd_args : List [str ] = []
311+ raise PythonEbpfError (exit_status , cmd_args , stdout , stderr )
307312
308313 def snapshot (self ) -> ProcessToProfileData :
309314 # Add health check at the beginning
0 commit comments