Path: utzoo!attcan!uunet!mcvax!enea!kth!draken!nordmark
From: nordmark@nada.kth.se (Arne Nordmark)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Problem trying to get RUN to work from processes w/no consoletask.
Message-ID: <660@draken.nada.kth.se>
Date: 30 Nov 88 08:16:21 GMT
References: <8811281929.AA18217@postgres.Berkeley.EDU>
Reply-To: stacken.kth.se!gno@uunet.uu.net (Gunnar Nordmark)
Organization: Royal Institute of Technology, Stockholm, Sweden
Lines: 48

In article <8811281929.AA18217@postgres.Berkeley.EDU> dillon@POSTGRES.BERKELEY.EDU (Matt Dillon) writes:
>	Try doing it from a detached process, that was my point.  RUN
>the program that contains the Execute("run date",0L,0L), but before
>the program does the Execute() close the console window:
>
>	RUN >nil: 	ENDCLI	
>
>	(charliex fclose(stderr) to remove "*" dependancy)
>	(console goes away)
>	(charliex sets pr_ConsoleTask = NULL or something else ... or 
>	 leave it what it was if you want to gurarentee a crash.  But
>	 even changing it guarentees a crash pretty much).
                          ^^^^^^^^^^^^^^^^^^

NO!!! If you set pr_ConsoleTask to a *valid* device-handler everything will
work perfectly. (Hey, you said this yourself in your amigamail, remember?)
That is what "null:" is all about. Just say
	pr_ConsoleTask=DeviceProc("null:");
and you won't crash anything, even though the console window is gone.

If you do
	pr_ConsoleTask=NULL;
or
	pr_ConsoleTask=DeviceProc("NIL:"); /* this yields NULL as well! */

you will crash the machine, but this will be fixed in 1.4 I hope.

Before 1.4 is available you have no choice. You *must* set pr_ConsoleTask
to a valid device-handler.

The obvious fix for 1.4 is this:
Whenever someone tries to do an Open("*",...), check the pr_ConsoleTask.
(this is allready done in 1.2). *but* if it doesn't contain a valid
device-handler (check the device-list) or if it is NULL, then do
an Open("NIL:",...) instead. Otherwise send the "open"-packet to the
apropriate device-handler, just as in 1.2.

There you are, no more problems with gone-away console windows.

   -- Gunnar

SNAIL: Gunnar Nordmark          VOICE: (+46) 8 - 755 42 52
       Nora strand 5
       S-182 34 DANDERYD        EMAIL: gno@stacken.kth.se
       SWEDEN                          gno@SESTAK.BITNET

"Words, words, words."  William Shakespeare