Hi Kriangkrai,

> The reason is that I want to do scripting in PicoLisp (thank you so
> much for sharing it :-). Sometimes I need to call a shell script,

You are welcome :-)

> which requires "interactive" input (and that I want it to still be
> "interactive").

OK, I understand.

> Nothing occur when running:
>   : (vi "file")
>   -> NIL

Sorry, this was my fault. The 'vi' function works only with symbols, not
with file names.

   : (vi 'vi)

> But using (call 'vi "file") works fine.


> Calling
>   : (raw NIL) (call 'sh "-c" "echo -n 'name: '; read name; echo $name") (ra=
> w T)
> does not work too on my system.

Yep, I tried a similar thing with calling setCooked() in doCall(). It
does not help.

But if I take out all that terminal control group stuff out of doCall()
(see the '// ' comments)

   if ((pid = fork()) == 0) {
      // setpgid(0,0);
      execvp(av[0], av);
   i = 0;  do
   while (++i < ac);
   if (pid < 0)
      err(ex, NULL, "fork");
   // setpgid(pid,0);
   // if (Termio)
   //    tcsetpgrp(0,pid);
   for (;;) {
      while (waitpid(pid, &res, WUNTRACED) < 0) {
         if (errno != EINTR)
            err(ex, NULL, "wait pid");
         if (Signal)
   //    if (Termio)
   //       tcsetpgrp(0,getpgrp());
      if (!WIFSTOPPED(res))
         return res == 0? T : Nil;
      load(NULL, '+', Nil);
   //    if (Termio)
   //       tcsetpgrp(0,pid);
      kill(pid, SIGCONT);

it works, without echoing the input, though. Then, when I then put a
(raw NIL) before the (call ..) and a (raw T) after, the echo (and Enter
as input terminator) also works.

However, then the terminal STOP signal does not work correctly any more.
The intended behavior was that upon Ctrl-Z in the executing program
(e.g. 'vi') it drops back to the PicoLisp '+' prompt, and when you hit
Ctrl-Z there again, you'll leave PicoLisp and are back on the Unix

So I don't remember completely at the moment, but all this terminal
stuff had some purpose. What would be the correct way here? Anybody firm
in such an exercise? (Randall?)

- Alex
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to