aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-10 02:45:38 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-10 02:45:38 +0000
commit258716bd9d5398b7e6a6375ef5dd4f23790c6af5 (patch)
tree29f564d8adc7a1ef6a57d27492a25d357476e9c5
parent3ffd8a918ff2cfd555bf7e89329b275d1fe8ab12 (diff)
downloadruby-258716bd9d5398b7e6a6375ef5dd4f23790c6af5.tar.gz
* process.c (rb_fork_internal): call after_fork only unless
chfunc_is_async_signal_safe. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--process.c3
-rw-r--r--test/ruby/test_process.rb9
3 files changed, 16 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 4f278ad041..9dbd689e5f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Jun 10 11:44:57 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_fork_internal): call after_fork only unless
+ chfunc_is_async_signal_safe.
+
Sun Jun 10 11:33:01 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
* ext/openssl/ossl_pkey_ec.c
diff --git a/process.c b/process.c
index b88ed846b7..619f6a9f04 100644
--- a/process.c
+++ b/process.c
@@ -2945,7 +2945,8 @@ rb_fork_internal(int *status, int (*chfunc)(void*, char *, size_t), void *charg,
_exit(127);
#endif
}
- after_fork();
+ if (!chfunc_is_async_signal_safe)
+ after_fork();
close(ep[1]);
error_occured = recv_child_error(ep[0], &state, &exc, &err, errmsg, errmsg_buflen, chfunc_is_async_signal_safe);
if (state || error_occured) {
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index 4ff4023b51..b3ecc420ed 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -1424,4 +1424,13 @@ class TestProcess < Test::Unit::TestCase
assert_nothing_raised { spawn(*TRUECOMMAND, :new_pgroup=>true) }
assert_nothing_raised { IO.popen([*TRUECOMMAND, :new_pgroup=>true]) {} }
end
+
+ def test_sigpipe
+ system(RUBY, "-e", "")
+ with_pipe {|r, w|
+ r.close
+ assert_raise(Errno::EPIPE) { w.print "a" }
+ }
+ end
+
end