Module: ChildProcess::Windows::Lib
- Extended by:
- FFI::Library
- Defined in:
- lib/childprocess/windows.rb,
lib/childprocess/windows/constants.rb,
lib/childprocess/windows/functions.rb
Class Method Summary collapse
Class Method Details
.create_proc(cmd, opts = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/childprocess/windows/functions.rb', line 17 def self.create_proc(cmd, opts = {}) cmd_ptr = FFI::MemoryPointer.from_string cmd si = StartupInfo.new pi = ProcessInfo.new ok = create_process(nil, cmd_ptr, nil, nil, !!opts[:inherit], 0, nil, nil, si, pi) ok or raise Error, close_handle pi[:hProcess] close_handle pi[:hThread] pi[:dwProcessId] end |
.last_error_message ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/childprocess/windows/functions.rb', line 5 def self. errnum = get_last_error buf = FFI::MemoryPointer.new :char, 512 size = ( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY, nil, errnum, 0, buf, buf.size, nil ) buf.read_string(size).strip end |