`(p1)
public
Returns the standard output of running cmd in a subshell. The
built-in syntax %x{…} uses this method. Sets $? to the process status.
`date`
`ls testdir`.split[1]
`echo oops && exit 99`
$?.exitstatus
Show source
static VALUE
rb_f_backquote(VALUE obj, VALUE str)
{
volatile VALUE port;
VALUE result;
rb_io_t *fptr;
SafeStringValue(str);
port = pipe_open_s(str, "r", FMODE_READABLE|DEFAULT_TEXTMODE, NULL);
if (NIL_P(port)) return rb_str_new(0,0);
GetOpenFile(port, fptr);
result = read_all(fptr, remain_size(fptr), Qnil);
rb_io_close(port);
return result;
}