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

483 Коммитов

Автор SHA1 Сообщение Дата
akr 826f98e688 * internal.h (rb_execarg_new): declared.
(rb_execarg_get): ditto.

* process.c (mark_exec_arg): new function.
  (free_exec_arg): ditto.
  (memsize_exec_arg): ditto.
  (exec_arg_data_type): defined.
  (rb_execarg_new): new function.
  (rb_execarg_get): ditto.
  (rb_f_exec): use rb_execarg_new.
  (rb_spawn_internal): ditto.
  (rb_f_spawn): ditto.

* io.c (pipe_open_v): use rb_execarg_new.
  (pipe_open_s): ditto.

* ext/pty/pty.c (establishShell): use rb_execarg_new.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20 10:31:02 +00:00
nobu 5a24475a13 process.c: fixnum umask
* process.c (rb_execarg_addopt): always make Fixnum, and ignore higher
  bits in too large umask value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20 02:33:06 +00:00
akr a60fe909d7 fix async-signal-safe comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-19 09:14:18 +00:00
nobu 52b497d8b7 process.c: no method calls in async-signal-safe
* process.c (rb_execarg_run_options): do not call any methods in the
  async-signal-safe function.  mask has been checked with NUM2MODET()
  already and converted with LONG2NUM().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-19 08:51:57 +00:00
akr ea325fcd67 * process.c (proc_exec_sh): don't strip leading spaces of the script.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-14 13:11:41 +00:00
akr b41bc68688 update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-13 20:55:40 +00:00
akr d793a86b43 update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-13 11:37:33 +00:00
akr e9a1ba232a * process.c (rb_fork_internal): move a variable declaration.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-13 11:20:33 +00:00
nobu 9c48976392 process.c: suppress warning
* process.c (compare_posix_sh): not used on Win32.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-13 07:38:06 +00:00
nobu 621153bf3f process.c: no SIZE_T_MAX
* process.c (rb_exec_fillarg): get rid of SIZE_T_MAX which may need
  more headers.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-13 01:20:29 +00:00
nobu 33b15cef6c process.c: fix array element size
* process.c (rb_exec_fillarg): fix array element size.  "continue" and
  "readonly" exceeded the size.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-13 01:20:05 +00:00
nobu 2d460925f2 process.c: use shell for reserved or special built-in
* process.c (rb_exec_fillarg): use shell if the first word is reserved
  or special built-in name.
  http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-13 00:56:31 +00:00
nobu e6a6561121 process.c: treat '=' only in the first word
* process.c (rb_exec_fillarg): treat '=' only in the first word.  if
  the first word does not contain '=', it is the command name and
  environment assignments cannot be anymore.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-13 00:55:31 +00:00
nobu 18c32c9451 process.c: constified
* process.c (rb_exec_fillarg): constified.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-13 00:54:32 +00:00
ngoto 3f4b0e17f4 * process.c (rb_exec_arg_fixup): fix compile error
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-12 13:55:42 +00:00
akr 640e0a33b7 * process.c (rb_exec_fillarg): treat '=' character as an meta
character to detect assignments preceding command name.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-12 12:41:08 +00:00
akr 37a1355bf8 * include/ruby/intern.h (rb_exec_arg_init): deprecated.
(rb_exec_arg_addopt): ditto.
  (rb_exec_arg_fixup): ditto.
  (rb_run_exec_options): ditto.
  (rb_run_exec_options_err): ditto.

* internal.h (rb_execarg_init): declared.
  (rb_execarg_addopt): ditto.
  (rb_execarg_fixup): ditto.
  (rb_execarg_run_options): ditto.

* process.c: call rb_execarg_addopt, rb_execarg_fixup,
  rb_execarg_run_options, rb_execarg_init.
  (rb_execarg_addopt): renamed from rb_exec_arg_addopt.
  (rb_exec_arg_addopt): stub to call rb_execarg_addopt.
  (rb_execarg_init): renamed from rb_exec_arg_init.
  (rb_exec_arg_init): stub to call rb_execarg_init.
  (rb_execarg_fixup): renamed from rb_exec_arg_fixup.
  (rb_exec_arg_fixup): stub to call rb_execarg_fixup.
  (rb_execarg_run_options): renamed from rb_run_exec_options_err.
  (rb_run_exec_options_err): stub to call rb_execarg_run_options.
  (rb_run_exec_options): call rb_execarg_run_options.

* io.c: call rb_execarg_addopt, rb_execarg_fixup,
  rb_execarg_run_options, rb_execarg_init.

* ext/pty/pty.c (establishShell): call rb_execarg_init and
  rb_execarg_fixup.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-12 11:34:51 +00:00
akr 45e5f2f690 * process.c (rb_exec_fillarg): detect '#' as a meta character.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-11 21:40:50 +00:00
akr ffe89b7621 add comment about meta characters.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-11 12:37:55 +00:00
akr 9ea35ccf30 * process.c (rb_proc_exec_n): revert the function removed at r35889.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 21:31:49 +00:00
akr fa5cd00340 * process.c (rb_exec_without_timer_thread): renamed from rb_exec_err.
(rb_exec_err): new stub function to call
  rb_exec_without_timer_thread.
  (rb_f_exec): call rb_exec_without_timer_thread.
  (rb_exec): call rb_exec_without_timer_thread.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 12:31:40 +00:00
akr 4fa66dc53b * process.c (rb_fork): call rb_fork_internal instead of rb_fork_err.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 12:13:33 +00:00
akr f589733a02 * process.c (rb_fork_ruby): call rb_fork_internal directly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 11:56:20 +00:00
akr 4b70fab915 * process.c (rb_fork_ruby): new function.
(rb_f_fork): use rb_fork_ruby instead of rb_fork.
  (rb_daemon): ditto.

* io.c (pipe_open): use rb_fork_ruby instead of rb_fork.

* internal.h (rb_fork_ruby): declared.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 11:21:07 +00:00
akr 8fdd48d69f * process.c (retry_fork): call after_fork except in a child process.
(rb_fork_internal): restrict after_fork call condition.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 06:51:05 +00:00
akr c39fd4c340 * process.c (rb_f_exec): call rb_exec_async_signal_safe except on
Mac OS X.  cf. the comment in before_exec_non_async_signal_safe.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 03:46:09 +00:00
akr 258716bd9d * 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
2012-06-10 02:45:38 +00:00
akr 839dc7d409 update async-signal-safe comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 01:46:45 +00:00
akr 18088467e7 * process.c (rb_exec_async_signal_safe): exported.
* ext/pty/extconf.rb: modify $INCFLAGS to include internal.h

* ext/pty/pty.c: include internal.h.
  (chfunc): don't call rb_thread_atfork_before_exec.  use
  rb_exec_async_signal_safe instead of rb_f_exec.
  (establishShell): set up earg.  use rb_fork_async_signal_safe
  instead of rb_fork_err.

* internal.h (rb_exec_async_signal_safe): declared.
  (rb_fork_async_signal_safe): declared.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 01:29:58 +00:00
akr 8fcdb757a5 * process.c (rb_f_exec): use rb_exec_arg_prepare.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 01:17:53 +00:00
akr 99c71b1ee4 * process.c: split after_exec into async-signal-safe part and rest.
(after_exec_async_signal_safe): extracted from after_exec.
  (after_exec_non_async_signal_safe): ditto.
  (after_exec): call them.
  (rb_exec_async_signal_safe): call after_exec_async_signal_safe.
  (rb_exec_err): call after_exec_non_async_signal_safe instead of
  after_exec.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 21:48:42 +00:00
akr f45eb45100 * process.c (rb_fork_internal): initialize exc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 16:37:44 +00:00
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