Class: ChildProcess::Windows::Process::Job
- Inherits:
-
Object
- Object
- ChildProcess::Windows::Process::Job
- Defined in:
- lib/childprocess/windows/process.rb
Instance Method Summary collapse
- #<<(handle) ⇒ Object
- #close ⇒ Object
-
#initialize ⇒ Job
constructor
A new instance of Job.
Constructor Details
#initialize ⇒ Job
Returns a new instance of Job.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/childprocess/windows/process.rb', line 82 def initialize @pointer = Lib.create_job_object(nil, nil) if @pointer.nil? || @pointer.null? raise Error, "unable to create job object" end basic = JobObjectBasicLimitInformation.new basic[:LimitFlags] = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE extended = JobObjectExtendedLimitInformation.new extended[:BasicLimitInformation] = basic ret = Lib.set_information_job_object( @pointer, JOB_OBJECT_EXTENDED_LIMIT_INFORMATION, extended, extended.size ) Lib.check_error ret end |
Instance Method Details
#<<(handle) ⇒ Object
105 106 107 |
# File 'lib/childprocess/windows/process.rb', line 105 def <<(handle) Lib.check_error Lib.assign_process_to_job_object(@pointer, handle.pointer) end |
#close ⇒ Object
109 110 111 |
# File 'lib/childprocess/windows/process.rb', line 109 def close Lib.close_handle @pointer end |