Method: Win32Open4::Kernel32.create_process

Defined in:
lib/procreate/win32/open4.rb

.create_process(command, stdin, stdout, stderr) ⇒ Object



159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/procreate/win32/open4.rb', line 159

def create_process(command, stdin, stdout, stderr)
  startupInfo = [
    STARTUP_INFO_SIZE,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW,
    0, 0, 0,
    stdin, stdout, stderr
  ].pack('IIIIIIIIIIIISSIIII')
  processInfo = [0, 0, 0, 0].pack('IIII')
  command = command + 0.chr
  raise_last_error! if CreateProcessA(0, command, 0, 0, 1, 0, 0, 0, startupInfo, processInfo).zero?
  # hProcess, hThread, dwProcessId, dwThreadId
  processInfo.unpack('LLLL')
end