Jon A. Lambert wrote:

> Jon A. Lambert wrote:
>
>> You might use CreateProcess from Win32api.
>> The PID is returned in the last parameter, the process_information
>> structure.
>> Then use that PID in calling OpenProcess to get the Handle to use
>> when calling TerminateProcess.
>
Jon, thank you very much. Your post pointed me at the right direction.

http://dev.instiki.org/file/instiki/trunk/test/watir/e2e.rb 
(E2EInstikiTest::startup and E2EInstikiTest::shutdown) contain a working 
implementation of starting / stopping Webrick process via Win32 API 
calls. Although it's somewhat ugly and needs proper error handling, but 
at least it works in a fair weather.

P.S. Ten lines of interesting stories to start / stop a process?... sigh...

-- 
Best regards,

Alexey Verkhovsky

Ruby Forum: http://ruby-forum.org        (moderator)
RForum:     http://rforum.andreas-s.net  (co-author)
Instiki:    http://instiki.org           (maintainer)