@@ -7812,31 +7812,18 @@ pipe_open(VALUE execarg_obj, const char *modestr, enum rb_io_mode fmode,
78127812}
78137813#endif
78147814
7815- static int
7816- is_popen_fork (VALUE prog )
7815+ static VALUE
7816+ execarg_new_cmd (VALUE prog )
78177817{
78187818 if (RSTRING_LEN (prog ) == 1 && RSTRING_PTR (prog )[0 ] == '-' ) {
78197819#if !defined(HAVE_WORKING_FORK )
78207820 rb_raise (rb_eNotImpError ,
78217821 "fork() function is unimplemented on this machine" );
78227822#else
7823- return TRUE ;
7823+ return Qnil ;
78247824#endif
78257825 }
7826- return FALSE;
7827- }
7828-
7829- static VALUE
7830- pipe_open_s (VALUE prog , const char * modestr , enum rb_io_mode fmode ,
7831- const struct rb_io_encoding * convconfig )
7832- {
7833- int argc = 1 ;
7834- VALUE * argv = & prog ;
7835- VALUE execarg_obj = Qnil ;
7836-
7837- if (!is_popen_fork (prog ))
7838- execarg_obj = rb_execarg_new (argc , argv , TRUE, FALSE);
7839- return pipe_open (execarg_obj , modestr , fmode , convconfig );
7826+ return rb_execarg_new (1 , & prog , TRUE, FALSE);
78407827}
78417828
78427829static VALUE
@@ -8054,9 +8041,7 @@ rb_io_popen(VALUE pname, VALUE pmode, VALUE env, VALUE opt)
80548041 }
80558042 else {
80568043 StringValue (pname );
8057- execarg_obj = Qnil ;
8058- if (!is_popen_fork (pname ))
8059- execarg_obj = rb_execarg_new (1 , & pname , TRUE, FALSE);
8044+ execarg_obj = execarg_new_cmd (pname );
80608045 }
80618046 if (!NIL_P (execarg_obj )) {
80628047 if (!NIL_P (opt ))
@@ -10663,13 +10648,14 @@ argf_readlines(int argc, VALUE *argv, VALUE argf)
1066310648static VALUE
1066410649rb_f_backquote (VALUE obj , VALUE str )
1066510650{
10651+ const int mode = FMODE_READABLE |DEFAULT_TEXTMODE ;
1066610652 VALUE port ;
1066710653 VALUE result ;
1066810654 rb_io_t * fptr ;
1066910655
1067010656 StringValue (str );
1067110657 rb_last_status_clear ();
10672- port = pipe_open_s ( str , "r" , FMODE_READABLE | DEFAULT_TEXTMODE , NULL );
10658+ port = pipe_open ( execarg_new_cmd ( str ) , "r" , mode , NULL );
1067310659 if (NIL_P (port )) return rb_str_new (0 ,0 );
1067410660
1067510661 GetOpenFile (port , fptr );
0 commit comments