Project

General

Profile

Actions

Feature #5945

open

Add the ability to mark a at_exit as process-local.

Added by robertgleeson (Robert Gleeson) over 10 years ago. Updated over 3 years ago.

Status:
Assigned
Priority:
Normal
Target version:
-
[ruby-core:42256]

Description

I'd like to propose a enhancement to at_exit.
It would be nice if you could stop a at_exit handler from running in subprocesses.
You can do this manually with this code:

parent = Process.pid

at_exit do 
  if parent == Process.pid 
     # …
  end
end

You can also do it by bypassing handlers:

at_exit do
  # …
end

fork do 
  exit!
end

But it would be nice if I could do:

at_exit(false) do
  # …
end

The first approach is kind of ugly, and the second approach isn't sustainable if code outside
your control can fork(…) without calling exit!.

Updated by mame (Yusuke Endoh) about 10 years ago

  • Status changed from Open to Assigned
  • Assignee set to matz (Yukihiro Matsumoto)

Matz, do you think this kind of feature is needed?
I guess you'll say, the argument should be a keyword option, at least.

at_exit(process_local: true) { ... }

--
Yusuke Endoh

Updated by kosaki (Motohiro KOSAKI) about 10 years ago

2012/3/30 mame (Yusuke Endoh) :

Issue #5945 has been updated by mame (Yusuke Endoh).

Status changed from Open to Assigned
Assignee set to matz (Yukihiro Matsumoto)

Matz, do you think this kind of feature is needed?
I guess you'll say, the argument should be a keyword option, at least.

at_exit(process_local: true) { ... }

I don't like this name. at_exit() is always process local. He hope to
make no subprocess inheritance option.

Updated by mame (Yusuke Endoh) over 9 years ago

  • Target version changed from 1.9.3 to 2.6
Actions #4

Updated by naruse (Yui NARUSE) over 4 years ago

  • Target version deleted (2.6)
Actions #5

Updated by nobu (Nobuyoshi Nakada) over 3 years ago

  • Description updated (diff)
Actions

Also available in: Atom PDF