[Win32utils-devel] win32-job, JRuby, kill and process_list

Heesob Park phasis at gmail.com
Fri Feb 7 01:47:47 UTC 2014


Hi,

2014-02-07 Daniel Berger <djberg96 at gmail.com>:
> Hi all,
>
> I'm getting one test failure with win32-job using JRuby 1.7.10 on Windows 7.
> It seems the kill method terminates the processes alright, but when I check
> the process list again, it's returning one pid
>
>   # job_test.rb
>   require 'win32/job'
>   include Win32
>
>   pid1 = Process.spawn('notepad')
>   pid2 = Process.spawn('notepad')
>
>   j = Job.new('test')
>   p j.process_list
>
>   j.add_process(pid1)
>   j.add_process(pid2)
>   p j.process_list # [pid1, pid2]
>
>   j.kill
>   p j.process_list # Should be empty, but JRuby returns one pid.
>
>   j.close
>
> Any ideas?
>
You assumed wrong on ProcessIdList  array values.

Read carefully the document(
http://msdn.microsoft.com/en-us/library/windows/desktop/ms684150(v=vs.85).aspx
)
ProcessIdList
A variable-length array of process identifiers returned by this call.
Array elements 0 through NumberOfProcessIdsInList-1 contain valid
process identifiers.

I committed the patch.

Regards,
Park Heesob


More information about the win32utils-devel mailing list