[comp.sys.amiga] Spawning programs, problems and questions

peter@sugar.uu.net (Peter da Silva) (10/30/88)

Spawning new programs in a CLI environment.

Sigh.

Yes, the CLI environment is damn fragile. If you don't make it just right
it'll barf on you. And some programs (Manx VI, for example) go out of their
way to make sure they're in one... they do weird things like opening new
windows if you get the slightest thing wrong. Finally, Execute sometimes just
plain hangs you. I don't know whether it's because the CLI environment is
wrong, whether it's detach.o, or whether it's ARP stuff... it's just not
reliable. fexecv is bogus: why go to the trouble of parsing your CLI command
line into arguments just to have it pack it back into a command line? Why
didn't they just implement system()?

If anyone can provide an implementation of "system()" that works:

	(1) From the workbench,
	(2) From the CLI,
	(3) From detached processes, and
	(4) From processes with no CLI structure at all

I'll be able to get Browser with CLI support out that much faster. Otherwise
I'm probably going to break down and give up on it. It's just not worth the
aggaravation to me. I'll probably have some support via IconX, since I can do
a nice clean workbench launch for that...

Oh why didn't Commodore or MetaComCo or whoever make CLI work as a TOOL for a
PROJECT icon in the first place? I hope the various shells will do this.

-- 
		Peter da Silva  `-_-'  peter@sugar.uu.net
		 Have you hugged  U  your wolf today?

	Disclaimer: I accept full responsibility for my own typos.

dillon@CORY.BERKELEY.EDU (Matt Dillon) (11/01/88)

:reliable. fexecv is bogus: why go to the trouble of parsing your CLI command
:line into arguments just to have it pack it back into a command line? Why
:didn't they just implement system()?
:
:If anyone can provide an implementation of "system()" that works:
:
:	(1) From the workbench,
:	(2) From the CLI,
:	(3) From detached processes, and
:	(4) From processes with no CLI structure at all

	Doesn't Execute() work (DOS library call).  You might have to
setup pr_CIS and pr_COS before running it, but it ought to work (not at 
home so I can't test this) in all cases.

	The problem with Execute() is that you can't get the exit value
of the program.

				-Matt

peter@sugar.uu.net (Peter da Silva) (11/01/88)

In article <8810311855.AA05614@cory.Berkeley.EDU>, dillon@CORY.BERKELEY.EDU (Matt Dillon) writes:
  I said:
> :If anyone can provide an implementation of "system()" that works:

> 	Doesn't Execute() work (DOS library call).

Sometimes it hangs (never returns). Maybe it's trying to solve the halting
problem?

> You might have to
> setup pr_CIS and pr_COS before running it, but it ought to work (not at 
> home so I can't test this) in all cases.

I'll try that, sounds like a great idea. As in "You idiot, Peter, why didn't
you think of that?". Gonna make things complex, though.

> 	The problem with Execute() is that you can't get the exit value
> of the program.

Least of my problems...
-- 
		Peter da Silva  `-_-'  peter@sugar.uu.net
		 Have you hugged  U  your wolf today?

	Disclaimer: I accept full responsibility for my own typos.

mikhe@tragicomix.liu.se (Mike Henry) (11/03/88)

In article <8810311855.AA05614@cory.Berkeley.EDU> dillon@CORY.BERKELEY.EDU (Matt Dillon) writes:
>:reliable. fexecv is bogus: why go to the trouble of parsing your CLI command
>:line into arguments just to have it pack it back into a command line? Why
>:didn't they just implement system()?
>:
>:If anyone can provide an implementation of "system()" that works:
>
>	The problem with Execute() is that you can't get the exit value
>of the program.
>
>				-Matt

    Here's another reason why ARP shouldn't go unchecked !! There's a
    "replacement" for Execute() called ASyncRun(), which works in a
    similar maner but returns the "childs" exit code. ARP also have
    the capabilities of parsing your CLI command line if you just
    pass it a template, other capabilities/features exist as well.
    Use SyncRun() if you need syncronicity. Check TransAmi #3 for
    details. (I've got the UK edition, so I don't know if it's in
    the OTHER one, it ought to be... B^)

		-Mike
-- 
INET : mikhe@majestix.liu.se                                          ///
UUCP : {seismo,mcvax,munnari}!enea!liuida!majestix!mikhe             ///
ARPA : mikhe%majestix.{ida.liu.se,UUCP}@seismo.CSS.GOV           \\\/// What
SNAIL: Mike Henry, Alsattersg. 3C:20, S-582 51 Linkoping SWEDEN   \XX/ Else??

mlelstv@faui44.informatik.uni-erlangen.de (Michael van Elst ) (11/04/88)

In article <8810311855.AA05614@cory.Berkeley.EDU> dillon@CORY.BERKELEY.EDU (Matt Dillon) writes:
>	The problem with Execute() is that you can't get the exit value
>of the program.

Since Kick1.2 you get the return value of the program and a -1 if
your program couldn't get loaded.
Thus you can't distinguish between 'not found' and 'return value = -1'.

But if you Execute("RUN program",0,0) you get the return value of the
RUN command and the program's return value is lost.

				Michael van Elst

E-mail: UUCP: ...uunet!unido!fauern!faui44!mlelstv

morgan@brambo.UUCP (Morgan W. Jones) (11/06/88)

Try this, it even allows a shell escape:

	if (cmd == "")
		Execute(cmd,Input(),0L);
	else
		Execute(cmd,0L,0L);


-- 
Morgan Jones                                 morgan@hcr.UUCP
Human Computing Resources, Toronto, Canada
"BMATH - 6 months and counting ..."