Граф коммитов

451 Коммитов

Автор SHA1 Сообщение Дата
akr b11046a61e * process.c: don't use non async-signal-safe functions in a child
process before exec, for invoking a command.
  (rb_exec_atfork): call rb_exec_async_signal_safe only.
  (retry_fork): take chfunc_is_async_signal_safe argument.  call
  before_fork and after_fork only unless chfunc_is_async_signal_safe.
  (send_child_error): take chfunc_is_async_signal_safe argument.
  send an exception only unless chfunc_is_async_signal_safe.
  (recv_child_error): take chfunc_is_async_signal_safe argument.
  receive an exception only unless chfunc_is_async_signal_safe.
  (rb_fork_internal): renamed from rb_fork_err and take
  chfunc_is_async_signal_safe argument.
  use rb_protect only unless chfunc_is_async_signal_safe.
  (rb_fork_err): call rb_fork_internal with false as
  chfunc_is_async_signal_safe.
  (rb_fork_async_signal_safe): call rb_fork_internal with true as
  chfunc_is_async_signal_safe.
  (rb_spawn_process): call rb_fork_async_signal_safe instead of
  rb_fork_err.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 15:25:34 +00:00
akr 14ec2c802d * process.c (rb_fork_err): rewrite a complex "if" statement.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 14:58:03 +00:00
akr d074d0df95 * process.c (before_exec_async_signal_safe): extracted from
before_exec.
  (before_exec_non_async_signal_safe): ditto.
  (before_exec): call before_exec_async_signal_safe and
  before_exec_non_async_signal_safe.
  (rb_exec_async_signal_safe): call before_exec_async_signal_safe.
  (rb_exec_err): call before_exec_non_async_signal_safe instead of
  before_exec.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 14:45:46 +00:00
akr 7057facef3 * process.c (retry_fork): rewrite a complex "for" statement by
simple statements. 


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 13:28:02 +00:00
akr 1ad3f4b05d * process.c (retry_fork): extracted from rb_fork_err.
(send_child_error): ditto.
  (recv_child_error): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 12:51:01 +00:00
akr a46bf824bf update async-signal-safe comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 02:09:10 +00:00
akr d410a38b8e * process.c (rb_exec_async_signal_safe): extracted from rb_exec_err.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 01:57:46 +00:00
akr 4da82e58a1 update async-signal-safe comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 01:40:22 +00:00
akr 4a9a7756da * process.c: simplified because close_others option is always
enabled by default.
  (rb_f_exec): don't need to set the option.
  (rb_exec_arg_prepare): don't need to set the option.  don't need
  default_close_others argument.
  (rb_spawn_internal): don't need to give default_close_others
  argument for rb_exec_arg_prepare.  don't need default_close_others
  argument.
  (rb_spawn_err): don't need to give default_close_others
  argument for rb_spawn_internal.
  (rb_spawn): don't need to give default_close_others
  argument for rb_spawn_internal.
  (rb_f_system): don't need to give default_close_others argument for
  rb_spawn_internal. 
  (rb_f_spawn): don't need to give default_close_others argument for
  rb_exec_arg_prepare. 



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 01:07:07 +00:00
akr 0ec4ae7c8e * process.c (rb_proc_exec): call before_exec() here addition to
rb_exec_err.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 00:01:58 +00:00
nobu 1102fd2f3e * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 22:44:01 +00:00
akr 2fb032b74b * process.c (rb_exec_err): before_exec() call moved from proc_exec_cmd
and proc_exec_sh.
  (rb_proc_exec): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 16:26:01 +00:00
akr b9824fbb08 * include/ruby/intern.h (rb_exec_arg_init): declaration changed to
return a value.

* process.c (rb_exec_arg_init): return a value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 16:13:26 +00:00
akr 795c5f9b40 * process.c: don't check the availability of FD_CLOEXEC. It should
be available if fork() is available.

* io.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 14:46:23 +00:00
akr ba1c1786d6 add comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 13:50:38 +00:00
akr 373a7d1a95 * process.c (rb_fork_err): revert r35955. The condition needs !chfunc
to close ep[0] and ep[1].  The catched exception is re-raised
  immediately after that if status is not NULL.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 13:43:48 +00:00
akr c17c8ebb14 * process.c (rb_exec_err): after_exec() call moved from proc_exec_cmd and
proc_exec_sh.
  (rb_proc_exec): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 10:57:10 +00:00
akr 86c82ad647 * process.c (ARGV_COUNT): unused macro removed.
(ARGV_SIZE): ditto.
  (ALLOC_ARGV): ditto.
  (ALLOC_ARGV_WITH_STR): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 10:02:00 +00:00
nobu 52c7036436 process.c: child process error state
* process.c (rb_fork_err): error state in the child process is prior
  to exceptions in proc_syswait().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 03:04:42 +00:00
nobu 182dc9d40d process.c, ext/pty/pty.c: status on errors
* process.c (rb_fork_err): determine status on errors.
* ext/pty/pty.c (establishShell): reraise exception if something
  raised during sleep.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 02:26:39 +00:00
akr 0d92aac602 * process.c (rb_fork_err): Fix the conditoin to use rb_protect.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-07 13:13:52 +00:00
akr 7e0c93b0c3 fix a comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-06 13:10:54 +00:00
akr 7f83b7e14f remove wrong comments.
earg is processed by surrounding rb_run_exec_options_err call.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-06 12:34:51 +00:00
akr 3c3b563205 * process.c (proc_exec_cmd) renamed from proc_exec_v.
(proc_exec_sh): renamed from rb_proc_exec_e.
  (proc_spawn_cmd_internal): renamed from proc_spawn_v.
  (proc_spawn_cmd): renamed from proc_spawn_n.
  (proc_spawn_sh): renamed from proc_spawn.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-06 12:33:28 +00:00
usa ee011f7b1f * process.c (try_with_sh): please take care of the macro defined by
you.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-06 12:20:58 +00:00
akr aaf6bde978 update async-signal-safe comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-06 11:58:09 +00:00
akr 70232e400c * process.c (proc_exec_v): don't call dln_find_exe_r here because it
is not async-signal-safe and proc_exec_v is called in a child
  process.
  command_abspath field of rb_exec_arg.
  (rb_exec_fillarg): call dln_find_exe_r and set command_abspath.
  (rb_exec_err): Give the absolute path of the invoking command for
  proc_exec_v, instead of the command name.

* internal.h: add command_abspath field for rb_exec_arg. 



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-06 11:49:30 +00:00
akr 7685837427 * process.c (try_with_sh): take envp argument.
(exec_with_sh): ditto.  use it for execve.
  (proc_exec_v): provide envp for try_with_sh.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-06 11:09:26 +00:00
usa 494d01410f * process.c (rb_run_exec_options_err): allocate a temporary buffer for
run_exec_dup2() for restoring fds on non-fork environments.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-06 03:39:40 +00:00
akr a4ef2bbdd1 * process.c (rb_exec_fillarg): check use_shell field before accessing
a union field.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 20:29:15 +00:00
akr c8d6b6e8fa * process.c (rb_spawn_process): prog variable is not used for Unix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 19:59:43 +00:00
akr 0acd09c9e5 update async-signal-safe comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 15:31:39 +00:00
akr 3162e673a1 * internal.h (rb_exec_arg_init): change return type to void.
* process.c (rb_exec_arg_init): don't return a value.
  (rb_exec_arg_prepare): ditto.
  (rb_spawn_process): don't take the prog argument.  extract the 
  information from earg.
  (rb_spawn_internal): follow rb_spawn_process change.
  (rb_f_spawn): ditto.

* io.c (pipe_open): don't take the prog argument.  extract the
  information from eargp.
  (pipe_open_v): follow pipe_open change.
  (pipe_open_s): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 15:24:32 +00:00
akr 53b17a769b * internal.h (rb_exec_arg): use union to represent command invocation
with/without shell.

* process.c: follow the rb_exec_arg change.

* io.c (pipe_open): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 14:53:31 +00:00
akr 71e7935331 update async-signal-safe comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 14:33:32 +00:00
akr ad5bfed17c * process.c (rb_exec_arg_fixup): allocate a temporary buffer for
run_exec_dup2 here because it should be async-signal-safe.
  (run_exec_dup2): use the temporary buffer.
  (run_exec_dup2_tmpbuf_size): new function.

* include/ruby/intern.h (rb_exec_arg): add dup2_tmpbuf field.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 12:59:40 +00:00
akr b1ae6e473e * process.c (strtok): declaration removed because it is not used.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 10:59:51 +00:00
akr e3d685907c * process.c (proc_spawn): don't detect simple command line here
because rb_exec_fillarg already did.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 10:35:47 +00:00
akr e58ec33721 * process.c (rb_exec_fillarg): bail out a loop eagerly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 10:21:22 +00:00
akr 5b13036fce * process.c: add comments about async-signal-safe.
* io.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 10:16:11 +00:00
akr 993b4f3911 add comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04 11:13:47 +00:00
akr 71fd73dff8 * process.c (rb_exec_fillarg): allocate one more element before
beginning in argv_str for try_with_sh.

* internal.h (ARGVSTR2ARGC): adjust for the above change.
  (ARGVSTR2ARGV): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04 11:01:41 +00:00
akr 41819dc447 * internal.h (ARGVSTR2ARGC): defined.
(ARGVSTR2ARGV): defined.

* process.c (proc_exec_v): use ARGVSTR2ARGV.
  (rb_spawn_process): use ARGVSTR2ARGC and ARGVSTR2ARGV.

* io.c (pipe_open): use ARGVSTR2ARGV.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04 10:19:32 +00:00
nobu de8eb56e88 merge definitions
* process.c (proc_exec_v, rb_proc_exec_e): merge definitions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04 05:46:24 +00:00
nobu b89e9bf544 unused parameter
* process.c (proc_spawn_n): remove unused parameter.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04 05:46:22 +00:00
nobu a99d3a6271 unused variables
* io.c (pipe_open): argc and argv are not used on win32.

* process.c (rb_spawn_process): remove already useless variables.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04 05:33:43 +00:00
usa 9bb642d65a * process.c (rb_exec_err): should preserve errno.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04 05:06:56 +00:00
usa 2493e48d40 * process.c (rb_run_exec_options_err): restore save_env() call for
non-fork environments.

* process.c (rb_exec_err): restore environments after the failure of
  exec to fix [ruby-core:44093] [Bug #6249] on non-fork environments


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04 02:36:11 +00:00
usa 859869e522 * io.c (pipe_open): follow up changes in r35889.
* process.c (proc_spawn_n): now uses char ** instead of VALUE *.

* process.c (rb_spawn_process): prog is now VALUE of String, not char *.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04 01:44:27 +00:00
akr 6b348951ca * process.c (rb_spawn_process): fix for Windows. not tested.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-03 15:45:46 +00:00