Sha256: 909e7926d711527b54cab6e3fc6d4a418a0ee9a2cac794ad50f7e2d71821ade1

Contents?: true

Size: 864 Bytes

Versions: 5

Compression:

Stored size: 864 Bytes

Contents

##########################################################################
# example_kill.rb
#
# Generic test script for futzing around Process.kill. This script
# requires the sys-proctable library.
#
# You can run this example via the 'example:kill' task.
##########################################################################
require "win32/process"

begin
  require "sys/proctable"
rescue LoadError
  STDERR.puts "Whoa there!"
  STDERR.puts "This script requires the sys-proctable package to work."
  STDERR.puts "You can find it at http://ruby-sysutils.sf.net"
  STDERR.puts "Exiting..."
  exit
end

include Sys

puts "VERSION: " + Process::WIN32_PROCESS_VERSION

IO.popen("notepad")
sleep 1 # Give it a chance to start before checking for its pid

pids = []

ProcTable.ps{ |s|
  pids.push(s.pid) if s.cmdline =~ /notepad/i
}

p Process.kill(9,pids.last)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
win32-process-0.8.1 examples/example_kill.rb
win32-process-0.8.0 examples/example_kill.rb
win32-process-0.7.5 examples/example_kill.rb
win32-process-0.7.4 examples/example_kill.rb
win32-process-0.7.0 examples/example_kill.rb