A
ara.t.howard
i'm constantly struggling with the fact that children need to use exit! to
prevent exit handlers registered in the parent being called twice, for example:
harp:~ > cat a.rb
at_exit{ puts 'parent' }
fork{
at_exit{ puts 'child' }
} and Process.wait
harp:~ > ruby a.rb
child
parent
parent
arggh. this is a neat work-around:
harp:~ > cat a.rb
at_exit{ puts 'parent' }
fork{
at_exit{ exit! }
at_exit{ puts 'child' }
} and Process.wait
harp:~ > ruby a.rb
child
parent
i'm sure i'm not the first one to think of this, but it sure is handy to
separate the parent's handlers from the child's... anyone see issues with
this?
-a
prevent exit handlers registered in the parent being called twice, for example:
harp:~ > cat a.rb
at_exit{ puts 'parent' }
fork{
at_exit{ puts 'child' }
} and Process.wait
harp:~ > ruby a.rb
child
parent
parent
arggh. this is a neat work-around:
harp:~ > cat a.rb
at_exit{ puts 'parent' }
fork{
at_exit{ exit! }
at_exit{ puts 'child' }
} and Process.wait
harp:~ > ruby a.rb
child
parent
i'm sure i'm not the first one to think of this, but it sure is handy to
separate the parent's handlers from the child's... anyone see issues with
this?
-a