B
Bob Batzinger
I have followed the discussion for getting the win32 methods
Process.create and Process.kill to work that have been posted earlier on
this forum. In an electronic signage project, I have no trouble getting
Ruby to create and destroy a process running ruby.exe or notepad.
However, when I try to use Ruby to open and close a browser application
like Firefox or a PDF viewer, the following code will open the
application but the kill method aborts with a error message "The handle
is invalid." I get this regardless of whether I use the full path name
of the application or the name without an extension of applications that
are located within a directory of the system PATH.
require 'rubygems'
require 'win32/process'
info = Process.create(
:app_name => '"c:\program files\mozilla firefox\firefox.exe"'
)
sleep 5
Process.kill(9, info.process_id)
This is very baffling to me and I would appreciate any hints or
suggestions on how to over come this problem. Thanks.
BTW, I am using win32-process-0.5.9 and Ruby 1.8.6. The same results are
obtained on both Win XP and Windows Vista.
Process.create and Process.kill to work that have been posted earlier on
this forum. In an electronic signage project, I have no trouble getting
Ruby to create and destroy a process running ruby.exe or notepad.
However, when I try to use Ruby to open and close a browser application
like Firefox or a PDF viewer, the following code will open the
application but the kill method aborts with a error message "The handle
is invalid." I get this regardless of whether I use the full path name
of the application or the name without an extension of applications that
are located within a directory of the system PATH.
require 'rubygems'
require 'win32/process'
info = Process.create(
:app_name => '"c:\program files\mozilla firefox\firefox.exe"'
)
sleep 5
Process.kill(9, info.process_id)
This is very baffling to me and I would appreciate any hints or
suggestions on how to over come this problem. Thanks.
BTW, I am using win32-process-0.5.9 and Ruby 1.8.6. The same results are
obtained on both Win XP and Windows Vista.