module ChildProcess::Windows

Constants

CTRL_BREAK_EVENT
CTRL_C_EVENT
DETACHED_PROCESS
DUPLICATE_SAME_ACCESS
FORMAT_MESSAGE_ARGUMENT_ARRAY
FORMAT_MESSAGE_FROM_SYSTEM
HANDLE_FLAG_INHERIT
INFINITE
INVALID_HANDLE_VALUE
PROCESS_ALL_ACCESS
PROCESS_QUERY_INFORMATION
PROCESS_STILL_ACTIVE
PROCESS_VM_READ
STARTF_USESTDHANDLES
WIN_SIGBREAK
WIN_SIGINT
WIN_SIGKILL

Public Class Methods

dont_inherit(file) click to toggle source
# File lib/childprocess/windows/api.rb, line 31
def dont_inherit(file)
  unless file.respond_to?(:fileno)
    raise ArgumentError, "expected #{file.inspect} to respond to :fileno"
  end

  handle = Lib.handle_for(file.fileno)

  ok = Lib.set_handle_information(handle, HANDLE_FLAG_INHERIT, 0)
  ok or raise Error, Lib.last_error_message
end
kill(signal, *pids) click to toggle source
# File lib/childprocess/windows/api.rb, line 4
def kill(signal, *pids)
  case signal
  when 'SIGINT', 'INT', :SIGINT, :INT
    signal = WIN_SIGINT
  when 'SIGBRK', 'BRK', :SIGBREAK, :BRK
    signal = WIN_SIGBREAK
  when 'SIGKILL', 'KILL', :SIGKILL, :KILL
    signal = WIN_SIGKILL
  when 0..9
    # Do nothing
  else
    raise Error, "invalid signal #{signal.inspect}"
  end

  pids.map { |pid| pid if send_signal(signal, pid) }.compact
end
waitpid(pid, flags = 0) click to toggle source
# File lib/childprocess/windows/api.rb, line 21
def waitpid(pid, flags = 0)
  wait_for_pid(pid, no_hang?(flags))
end
waitpid2(pid, flags = 0) click to toggle source
# File lib/childprocess/windows/api.rb, line 25
def waitpid2(pid, flags = 0)
  code = wait_for_pid(pid, no_hang?(flags))

  [pid, code] if code
end