Module: ChildProcess::Windows

Defined in:
lib/childprocess/windows.rb,
lib/childprocess/windows/api.rb,
lib/childprocess/windows/handle.rb,
lib/childprocess/windows/process.rb,
lib/childprocess/windows/structs.rb,
lib/childprocess/windows/constants.rb,
lib/childprocess/windows/functions.rb

Defined Under Namespace

Modules: Lib Classes: Handle, Process, ProcessInfo, StartupInfo

Constant Summary collapse

FORMAT_MESSAGE_FROM_SYSTEM =
0x00001000
FORMAT_MESSAGE_ARGUMENT_ARRAY =
0x00002000
PROCESS_ALL_ACCESS =
0x1F0FFF
PROCESS_QUERY_INFORMATION =
0x0400
PROCESS_VM_READ =
0x0010
PROCESS_STILL_ACTIVE =
259
INFINITE =
0xFFFFFFFF
WIN_SIGINT =
2
WIN_SIGBREAK =
3
WIN_SIGKILL =
9
CTRL_C_EVENT =
0
CTRL_BREAK_EVENT =
1

Class Method Summary collapse

Class Method Details

.kill(signal, *pids) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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) ⇒ Object



21
22
23
# 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) ⇒ Object



25
26
27
28
29
# 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