Class: Aggkit::ChildProcess::Windows::Process

Inherits:
AbstractProcess show all
Defined in:
lib/aggkit/childprocess/windows/process.rb

Defined Under Namespace

Classes: Job

Constant Summary

Constants inherited from AbstractProcess

AbstractProcess::POLL_INTERVAL

Instance Attribute Summary collapse

Attributes inherited from AbstractProcess

#cwd, #detach, #duplex, #environment, #exit_code, #leader, #status

Instance Method Summary collapse

Methods inherited from AbstractProcess

#alive?, #crashed?, #initialize, #poll_for_exit, #start, #started?

Constructor Details

This class inherits a constructor from Aggkit::ChildProcess::AbstractProcess

Instance Attribute Details

#pidObject (readonly)

Returns the value of attribute pid.



6
7
8
# File 'lib/aggkit/childprocess/windows/process.rb', line 6

def pid
  @pid
end

Instance Method Details

#exited?Boolean

Returns:

  • (Boolean)


38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/aggkit/childprocess/windows/process.rb', line 38

def exited?
  return true if @exit_code
  assert_started

  code   = @handle.exit_code
  exited = code != PROCESS_STILL_ACTIVE

  log(:exited? => exited, :code => code)

  if exited
    @exit_code = code
    close_handle
    close_job_if_necessary
  end

  exited
end

#ioObject



8
9
10
# File 'lib/aggkit/childprocess/windows/process.rb', line 8

def io
  @io ||= Windows::IO.new
end

#stop(timeout = 3) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/aggkit/childprocess/windows/process.rb', line 12

def stop(timeout = 3)
  assert_started

  log "sending KILL"
  @handle.send(WIN_SIGKILL)

  poll_for_exit(timeout)
ensure
  close_handle
  close_job_if_necessary
end

#waitObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/aggkit/childprocess/windows/process.rb', line 24

def wait
  if exited?
    exit_code
  else
    @handle.wait
    @exit_code = @handle.exit_code

    close_handle
    close_job_if_necessary

    @exit_code
  end
end