Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

We have spawn, and now we need exec

2 views
Skip to first unread message

Dan Sugalski

unread,
Aug 5, 2004, 1:31:09 PM8/5/04
to perl6-i...@perl.org
Which was just a dopey oversight on my part when this got put in.

I'm adding an exec opcode alongside the spawn opcode. Does what you'd
expect an exec to do.

I've updated config/gen/platform generic/exec.c with proper code, and
win32/exec.c and ansi/exec.c with a stub that pitches a fit if you
try it, though I'd love it if someone with windows experience could
fill in the blank there.
--
Dan

--------------------------------------it's like this-------------------
Dan Sugalski even samurai
d...@sidhe.org have teddy bears and even
teddy bears get drunk

Brent 'Dax' Royal-Gordon

unread,
Aug 5, 2004, 1:37:40 PM8/5/04
to Dan Sugalski, perl6-i...@perl.org
Dan Sugalski wrote:
> I'd love it if someone with windows experience could fill in
> the blank there.

Just add an _ before exec.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_crt__exec.2c_._wexec_functions.asp

--
Brent "Dax" Royal-Gordon <br...@brentdax.com>
Perl and Parrot hacker

Oceania has always been at war with Eastasia.

Dan Sugalski

unread,
Aug 5, 2004, 1:43:29 PM8/5/04
to Brent 'Dax' Royal-Gordon, perl6-i...@perl.org
At 10:37 AM -0700 8/5/04, Brent 'Dax' Royal-Gordon wrote:
>Dan Sugalski wrote:
>>I'd love it if someone with windows experience could fill in the blank there.
>
>Just add an _ before exec.
>
>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_crt__exec.2c_._wexec_functions.asp

Cool. On the Unix platforms we exec off 'sh' and pass in parameters
(so we get command parameters split up right, IIRC). I'm presuming we
don't do the same for Windows, so I'll make it the plain command and
hope it all works out.

Thanks.

Aaron Sherman

unread,
Aug 5, 2004, 2:11:45 PM8/5/04
to Dan Sugalski, Perl6 Internals List
On Thu, 2004-08-05 at 13:43, Dan Sugalski wrote:

> Cool. On the Unix platforms we exec off 'sh' and pass in parameters
> (so we get command parameters split up right, IIRC). I'm presuming we
> don't do the same for Windows, so I'll make it the plain command and
> hope it all works out.

Well, that's one way you can do it, but it causes a ton of headaches,
e.g. because

exec "echo <user's text goes here>"

gets shell interpretation and fails, so by way of example only, Perl 5
allows for both usages depending on what you pass it. Parrot could
easily make the distinction based on being passed a string value or a
PMC array of some sort and end up with roughly the same functionality as
Perl (though Perl itself would not use this as-is, as it decides further
based on the content of the string, and will call raw exec(2) on the
results of splitting the string on whitespace if no shell metacharacters
occur, but I think that's a bit too much Perlishness to put in Parrot).

Either way, Parrot really HAS to provide a raw POSIX exec, as it cannot
be faked from a shell-using variant correctly.

--
781-324-3772
a...@ajs.com
http://www.ajs.com/~ajs

Aaron Sherman

unread,
Aug 5, 2004, 2:14:18 PM8/5/04
to Perl6 Internals List
On Thu, 2004-08-05 at 14:11, Aaron Sherman wrote:

> Parrot could
> easily make the distinction based on being passed a string value or a
> PMC array of some sort and end up with roughly the same functionality as
> Perl (though Perl itself would not use this as-is, as it decides further
> based on the content of the string, and will call raw exec(2) on the
> results of splitting the string on whitespace if no shell metacharacters
> occur, but I think that's a bit too much Perlishness to put in Parrot).

"Run-on sentence from hell" barely begins to describe the horror... I'm
so sorry about that. Please, do me a favor and breath whenever you feel
like it.... ;-)

Dan Sugalski

unread,
Aug 5, 2004, 2:17:47 PM8/5/04
to Aaron Sherman, Perl6 Internals List

Yeah, we really *should* do it right, rather than take the cheating
way out as we are now. I'll go add this to the TODO list.

Jonathan Worthington

unread,
Aug 5, 2004, 7:06:01 PM8/5/04
to perl6-i...@perl.org, Dan Sugalski
"Dan Sugalski" <d...@sidhe.org> wrote:
> Which was just a dopey oversight on my part when this got put in.
>
> I'm adding an exec opcode alongside the spawn opcode. Does what you'd
> expect an exec to do.
>
> I've updated config/gen/platform generic/exec.c with proper code, and
> win32/exec.c and ansi/exec.c with a stub that pitches a fit if you
> try it, though I'd love it if someone with windows experience could
> fill in the blank there.
>
Here's my attempt to fill the blank. Tested, appears to work.

Jonathan

win32_exec.patch

Dan Sugalski

unread,
Aug 7, 2004, 10:09:58 AM8/7/04
to Jonathan Worthington, perl6-i...@perl.org

Applied, thanks!

0 new messages