pike.git / lib / modules / Process.pmod

version» Context lines:

pike.git/lib/modules/Process.pmod:207:    "stderr":mystderr->pipe(),    "stdin":mystdin->pipe(Stdio.PROP_IPC|Stdio.PROP_REVERSE)    ]));    }    else    p = Process(cmd, modifiers + ([    "stdout":mystdout->pipe(),    "stderr":mystderr->pipe(),    ]));    - #if constant(Thread.Thread) + #if 0 //constant(Thread.Thread) +  // This is disabled by default since the callback alternative is +  // much more lightweight - creating threads isn't cheap.    array threads = ({    thread_create( lambda() { gotstdout = mystdout->read(); } ),    thread_create( lambda() { gotstderr = mystderr->read(); } )    });       if (mystdin) {    threads += ({    thread_create(lambda(Stdio.File f) { f->write(stdin_str); }, mystdin )    });    mystdin = 0;    }       exitcode = p->wait();    threads->wait(); - #else //No threads, use callbacks + #else    Pike.SmallBackend backend = Pike.SmallBackend();       mystdout->set_backend (backend);    mystderr->set_backend (backend);       mystdout->set_read_callback( lambda( mixed i, string data) {    gotstdout += data;    } );    mystderr->set_read_callback( lambda( mixed i, string data) {    gotstderr += data;