@@ -328,6 +328,7 @@ def _read_until_prompt(self, client_file):
328
328
if not data :
329
329
break
330
330
msg = json .loads (data .decode ())
331
+ print (msg )
331
332
messages .append (msg )
332
333
if 'prompt' in msg :
333
334
break
@@ -482,27 +483,37 @@ def bar():
482
483
483
484
with process :
484
485
485
- # Skip initial messages until we get to the prompt
486
- self ._read_until_prompt (client_file )
487
-
488
- # Continue execution
489
- self ._send_command (client_file , "c" )
490
-
491
- # Send keyboard interrupt signal
492
- self ._send_command (client_file , json .dumps ({"signal" : "INT" }))
493
- self ._send_interrupt (process .pid )
494
- messages = self ._read_until_prompt (client_file )
486
+ try :
495
487
496
- # Verify we got the keyboard interrupt message
497
- interrupt_msg = next (msg ['message' ] for msg in messages if 'message' in msg )
498
- self .assertIn ("bar()" , interrupt_msg )
488
+ # Skip initial messages until we get to the prompt
489
+ self ._read_until_prompt (client_file )
499
490
500
- # Continue to end
501
- self ._send_command (client_file , "iterations = 0" )
502
- self ._send_command (client_file , "c" )
503
- stdout , _ = process .communicate (timeout = 5 )
504
- self .assertIn ("Function returned: 42" , stdout )
505
- self .assertEqual (process .returncode , 0 )
491
+ # Continue execution
492
+ self ._send_command (client_file , "c" )
493
+
494
+ # Send keyboard interrupt signal
495
+ self ._send_interrupt (process .pid )
496
+ messages = self ._read_until_prompt (client_file )
497
+ print (messages )
498
+ print (process .stdout .readline ())
499
+ print (process .returncode )
500
+
501
+ # Verify we got the keyboard interrupt message
502
+ interrupt_msg = next (msg ['message' ] for msg in messages if 'message' in msg )
503
+ self .assertIn ("bar()" , interrupt_msg )
504
+
505
+ # Continue to end
506
+ self ._send_command (client_file , "iterations = 0" )
507
+ self ._send_command (client_file , "c" )
508
+ stdout , _ = process .communicate (timeout = 5 )
509
+ self .assertIn ("Function returned: 42" , stdout )
510
+ self .assertEqual (process .returncode , 0 )
511
+
512
+ except Exception as e :
513
+ stdout , stderr = process .communicate (timeout = 5 )
514
+ print (stderr )
515
+ print (stdout )
516
+ raise e from None
506
517
507
518
def test_handle_eof (self ):
508
519
"""Test that EOF signal properly exits the debugger."""
0 commit comments