setsid doesn't do what you need, you need a tty/pty pair to do that stuff. I don't think anybody would object if you implement tty/pty allocation. Hint: Originally I envisioned it being an argument to Stdio.File()->pipe().
/ Fredrik (Naranek) Hubinette (Real Build Master)
Previous text:
2003-04-15 21:17: Subject: Pike Cookbook
My biggest beef with Pike is that I can't get reliable Expect-like process control. Controlling things like yppasswd with create_process() and setsid does not work on both Solaris and Linux. I have spent hours reading the C code of both Pike and Expect trying to figure out what they do diffrently. So far without any luck.
I'm also starting to think that there could be a lower typing-overhead convienece version of Process.create_process(). I'm seeing a little bit to much of this in my scripts:
void timeout_handler(int signal) { write_errorlog("FATAL: operation timed out on SIGALRM. Aborting.\n"); exit(10); }
int main() { ...
alarm(180); /* 3 minutes should be enough for everyone... */
signal(signum("SIGALRM"), timeout_handler);
Stdio.File mystdout = Stdio.File(); Stdio.File mystderr = Stdio.File(); Stdio.File mystdin = Stdio.File(); object p=Process.create_process( ({ "/opt/timekeeper/settime", "-d", domain }), ([ "stdout" : mystdout->pipe(), "stderr" : mystderr->pipe(), "stdin" : mystdin->pipe(), ]) ); mystdin->write( time +"\n" ); int error = p->wait(); if(error) { write_errorlog("so: %O", mystdout->read(); write_errorlog("se: %O", mystderr->read(); fatalexit(11, "FATAL: Error %d for domain %s", error, domain ); } else { write_log("Domain %s worked out fine.", domain"); }
alarm(0);
... }
/ Peter Bortas