Hello, Zhaoming Luo, le lun. 03 févr. 2025 12:22:11 +0800, a ecrit: > ``` > Run 1, 13:51:24 - 13:51:24 in 0.020000 seconds: > command line..script > /<<PKGBUILDDIR>>/src/vim-gtk3/testdir/runtest.vim[617]..function > RunTheTest[57]..Test_keep_pty_open line 6: Expected range 200 - 1000, but got > 20
So it believes it's taking only 20ms. > The test source code (in vim script): > ``` > func Test_keep_pty_open() > CheckUnix > > let job = job_start(s:python . ' -c "import time;time.sleep(0.2)"', > \ {'out_io': 'null', 'err_io': 'null', 'pty': 1}) > let elapsed = WaitFor({-> job_status(job) ==# 'dead'}) > call assert_inrange(200, 1000, elapsed) > call job_stop(job) > endfunc > ``` > ... > 5.790000 : Starting job: python3 -c import time;time.sleep(0.2) > 5.800000 on 0: Created channel > 5.800000 on 0: using pty /dev/ttyp5 on fd 4 > 5.800000 : SafeState: Start triggering > 5.800000 : raw terminal output: <messy stuff...> > 5.800000 : looking for messages on channels > 5.800000 on 0: Closing channel because all readable fds are closed > 5.800000 on 0: Closing channel > 5.800000 : SafeState: back to waiting, triggering SafeStateAgain > 5.800000 : closing logfile vimlog > 5.810000 : looking for messages on channels > 5.810000 on 0: Job ended > ... > ``` So it apparently indeed takes only 20ms, it's not a measurement problem. > It's still the case with different sleep times. I believe the issue is > related to: > > ``` > 5.800000 on 0: Closing channel because all readable fds are closed > 5.800000 on 0: Closing channel > ``` I'm not really surprised since it sets out_io and err_io to null. And it is indeed saying it's back to waiting, and should be then waiting for the process to actually finish. You can try to add printing debugging in the waiting function up to the one that would be supposed to actually wait. Also, to rule out python implementation concerns, maybe replace the python script call with your own C program that does the wait and make it emit debugging stuff to a /tmp file, to make sure that it's really still alive after the sleep. Samuel