From: Felipe Bergo <bergo@se...> - 2001-10-23 06:54:02
On Mon, 22 Oct 2001, Daniel Burrows wrote:
> Of course, "perl" seems to be hardcoded in script.cc, but I see no
> reason why it couldn't simply execute a script named by the user (which
> could specify its own interpreter).
The original reason is: a long long time ago, I tried "/bin/sh -c
script-path" or something similar which I can't recall and for some odd
reason, with Perl, I'd get a bash child process and perl under it, but
perl would change its PGID, so eboard would fail to kill the script when
the user clicked the Kill button.
Now, much after that, networking code (which has process spawning with
pipes) has changed (mostly to fix issues with engines), and after getting
this piece of email I tried again the /bin/sh -c thing and it seems it is
working without problems. The only change was in script.cc:
- child=new PipeConnection("perl",fp,0,0,0);
+ child=new PipeConnection("/bin/sh","-c",fp,0,0);
(fp is the script's path, if you're wondering, the implementation of
PipeConnection is in network.cc)
It looks like it's working. It's late, I'm sleepy, not with much mood to
write a gazillion scripts to test it tonight.
> #!/usr/bin/expect -f
> expect ogin:
> send "YOUR_USERNAME_HERE\r"
> expect word:
> send "YOUR_PASSWORD_HERE\r"
This script would look like something else (I'm not sure about \n and \r,
I used \n to test around here, without problems)
The hello line is needed for eboard to detect the liveliness of the
script. Whatever language you use you'll need it.
As for the expect Starting line, today was my first try at expect, but for
some reason eboard doesn't seem to get the last "send" if the script
terminates right after it.
I'll test a little more, then include the change in the next version of
eboard if no problems are found.
Also there's a problem that eboard uses the second # comment in the file
to get a script description to show in the scripts dialog. With languages
that don't accept # for comments, this can get tricky.
Felipe Paulo Guazzi Bergo - Free Software Developer (bergo@...)
GPG/PGP mail welcome - GPG/PGP Key: EF8EE808 (keyserver pgp.mit.edu)
http://www.advogato.org/person/khazad - Campinas - SP - Brazil - Earth
* A polar bear is a rectangular bear after a coordinate transform.