Module: Bundler::Codegraph::Subprocess
- Defined in:
- lib/bundler/codegraph/subprocess.rb
Overview
Runs codegraph as a child process, stdin and stdout closed off.
Kernel#system would leave the child running when this process alone
is interrupted (SIGTERM to Ruby, not its process group): the cleanup that
follows — removing a partial index, releasing the lock — would then happen
under a live codegraph. The child is stopped and reaped first.
Constant Summary collapse
- STOP_TIMEOUT =
How long a child gets to exit on TERM before it is killed.
5
Class Method Summary collapse
-
.run(argv, stderr) ⇒ Boolean?
Like
system, except that a child killed by a signal (the OOM killer) gives nil, as one that cannot be started: it did not fail, it was stopped.
Class Method Details
.run(argv, stderr) ⇒ Boolean?
Returns like system, except that a child killed by a
signal (the OOM killer) gives nil, as one that cannot be started: it
did not fail, it was stopped.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/bundler/codegraph/subprocess.rb', line 22 def self.run(argv, stderr) pid = Process.spawn(*argv, in: File::NULL, out: File::NULL, err: stderr) status = Process.wait2(pid).last pid = nil status.success? || (status.signaled? ? nil : false) rescue SystemCallError nil ensure stop(pid) if pid end |