Module: PTY

Defined in:
pty.c

Defined Under Namespace

Classes: ChildExited

Class Method Summary collapse

Class Method Details

.getptyObject

ruby function: getpty



# File 'pty.c'

static VALUE
pty_getpty(argc, argv, self)
int argc;
VALUE *argv;
VALUE self;
{
VALUE res;
struct pty_info info;
struct pty_info thinfo;
OpenFile *wfptr,*rfptr;
VALUE rport = rb_obj_alloc(rb_cFile);
VALUE wport = rb_obj_alloc(rb_cFile);

MakeOpenFile(rport, rfptr);
MakeOpenFile(wport, wfptr);

establishShell(argc, argv, &info);

rfptr->mode = rb_io_mode_flags("r");
rfptr->f = fdopen(info.fd, "r");
rfptr->path = strdup(SlaveName);

wfptr->mode = rb_io_mode_flags("w") | FMODE_SYNC;
wfptr->f = fdopen(dup(info.fd), "w");
wfptr->path = strdup(SlaveName);

res = rb_ary_new2(3);
rb_ary_store(res,0,(VALUE)rport);
rb_ary_store(res,1,(VALUE)wport);
rb_ary_store(res,2,INT2FIX(info.child_pid));

thinfo.thread = rb_thread_create(pty_syswait, (void*)&info);
thinfo.child_pid = info.child_pid;
rb_thread_schedule();

if (rb_block_given_p()) {
rb_ensure(rb_yield, res, pty_finalize_syswait, (VALUE)&thinfo);
return Qnil;
}

.protect_signalObject

ruby function: protect_signal - obsolete



# File 'pty.c'

static VALUE
pty_protect(self)
    VALUE self;
{
    rb_warn("PTY::protect_signal is no longer needed");
    rb_yield(Qnil);
    return self;
}

.reset_signalObject

ruby function: reset_signal - obsolete



# File 'pty.c'

static VALUE
pty_reset_signal(self)
    VALUE self;
{
    rb_warn("PTY::reset_signal is no longer needed");
    return self;
}

.spawnObject

ruby function: getpty



# File 'pty.c'

static VALUE
pty_getpty(argc, argv, self)
int argc;
VALUE *argv;
VALUE self;
{
VALUE res;
struct pty_info info;
struct pty_info thinfo;
OpenFile *wfptr,*rfptr;
VALUE rport = rb_obj_alloc(rb_cFile);
VALUE wport = rb_obj_alloc(rb_cFile);

MakeOpenFile(rport, rfptr);
MakeOpenFile(wport, wfptr);

establishShell(argc, argv, &info);

rfptr->mode = rb_io_mode_flags("r");
rfptr->f = fdopen(info.fd, "r");
rfptr->path = strdup(SlaveName);

wfptr->mode = rb_io_mode_flags("w") | FMODE_SYNC;
wfptr->f = fdopen(dup(info.fd), "w");
wfptr->path = strdup(SlaveName);

res = rb_ary_new2(3);
rb_ary_store(res,0,(VALUE)rport);
rb_ary_store(res,1,(VALUE)wport);
rb_ary_store(res,2,INT2FIX(info.child_pid));

thinfo.thread = rb_thread_create(pty_syswait, (void*)&info);
thinfo.child_pid = info.child_pid;
rb_thread_schedule();

if (rb_block_given_p()) {
rb_ensure(rb_yield, res, pty_finalize_syswait, (VALUE)&thinfo);
return Qnil;
}