@@ -103,9 +103,23 @@ def test_waitpid(self):
103
103
@unittest .skipIf (sys .platform == 'win32' , "Posix-specific" )
104
104
def test_waitpid_group_child (self ):
105
105
import os
106
- p = subprocess .Popen ([sys .executable , "-c" , "import time; time.sleep(0.1); 42" ])
106
+ p = subprocess .Popen ([sys .executable , "-c" , "import time; print('before'); time.sleep(0.1); print('after'); 42" ],
107
+ stdin = subprocess .PIPE , stdout = subprocess .PIPE ,
108
+ stderr = subprocess .PIPE )
109
+ ps_list = 'not available'
110
+ if sys .implementation .name == "graalpy" and \
111
+ __graalpython__ .posix_module_backend != 'java' \
112
+ and sys .platform .startswith ("linux" ):
113
+ ps_list = subprocess .check_output ("ps" , shell = True , text = True )
107
114
res = os .waitpid (0 , 0 )
108
- assert res [1 ] == 0 , res
115
+ msg = f"Spawned { p .pid = } , os.waitpid result={ res } , output of ps:\n { ps_list } "
116
+ try :
117
+ stdout , stderr = p .communicate (timeout = 5 )
118
+ except subprocess .TimeoutExpired :
119
+ p .kill ()
120
+ stdout , stderr = p .communicate ()
121
+ msg += f"\n { stdout .decode ().strip ()= } , { stderr .decode ().strip ()= } "
122
+ assert res [1 ] == 0 , msg
109
123
110
124
# @unittest.skipIf(sys.platform == 'win32', "Posix-specific")
111
125
# Skipped because of transient: https://jira.oci.oraclecorp.com/browse/GR-65714
0 commit comments