File: process.rb

package info (click to toggle)
ruby-childprocess 5.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 260 kB
  • sloc: ruby: 1,285; makefile: 4
file content (28 lines) | stat: -rw-r--r-- 585 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require_relative '../process_spawn_process'

module ChildProcess
  module Windows
    class Process < ProcessSpawnProcess
      def io
        @io ||= Windows::IO.new
      end

      def stop(timeout = 3)
        assert_started
        send_kill

        begin
          return poll_for_exit(timeout)
        rescue TimeoutError
          # try next
        end

        wait
      rescue Errno::ECHILD, Errno::ESRCH
        # handle race condition where process dies between timeout
        # and send_kill
        true
      end
    end # Process
  end # Windows
end # ChildProcess