Amiga.org

Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: Jose on June 15, 2005, 06:24:43 PM

Title: RunCommand's crashing on 2nd call...
Post by: Jose on June 15, 2005, 06:24:43 PM
So I'm using RunCommand on a separate process created by the main one. I choosed it cause I saw no need to run the command its invocating asychronously again (RunCommand runs the specified command sychronously), as the process wich runs RunCommand is already asynchronous.
But I'm getting allways -1 as the return values ?! Ok I admit it that I only tried whith Digicam (on Aminet ) and then with the dir command just to be sure it wansn't a Digicam problem. But even dir returned -1. The docs say that a -1 return values means the stack couldn't be allocated. Later on the includes it's mentioned that -1 means a failure.
BUT:
- dir runs fine, as I can see the output but still returns -1. Then my program enters a loop of timed retries, all having the same result. Heck I though dir as it's an OS command (probably resident) would work ?
- digicam runs well 1st time but when entering mentioned loop it crashes badly.
I assume the crash is not my programs fault and maybe digicam's ? or whatever really :-?

I'm using LoadSeg to get the BPTR that RunCommand accepts, I suppose the pointer is still valid after using RunCommand or do I have to UnLoadSeg and LoadSeg again...:-x, Nah I don't think so...

BTW, just FYI this separate process is supposed to handle the buffer to get picture frames and also supports VHI (in the works) and any command line program the user specifies, for flexbility (hence why I'm testing it with Digicam).
 
Any ideas appreciated as allways.. (forgot the source at home...) ...  :-?
 8-)    
Title: Re: RunCommand's allways returning -1 ?!
Post by: Jose on June 15, 2005, 07:29:15 PM
I just had a flash that it migh be the checking of the return value I'm doing. I probably forgot to use == instead of =  :oops:
Not tested yet, I'll see it when I get home...

Still, I bet Digicam will still crash...
Title: Re: RunCommand's allways returning -1 ?!
Post by: Piru on June 15, 2005, 07:56:02 PM
Quote
I'm using LoadSeg to get the BPTR that RunCommand accepts, I suppose the pointer is still valid after using RunCommand or do I have to UnLoadSeg and LoadSeg again..., Nah I don't think so...

You must. Some programs might run fine without reloading, but you really can't know if program x will, thus you can't trust it (the problem is that bss, data are no longer the same as at load time). Pure and reentrant (resident) programs work without reloading obviously.
Title: Re: RunCommand's allways returning -1 ?!
Post by: Jose on June 16, 2005, 04:37:17 PM
@Piru
Didn't knew that, and it must be my problem as I'm getting a #80000004 (illegal instruction if I remember ...). I'll try it when I get home.

BTW, I suppose I can't use the resident command on DigiCam to make it resident then... The main disadvantage of constantly using LoadSeg to me would be that the HD would be constantly working. Maybe I could do 2 load Segs and copy from one to the other (how do I find the end of the code then ?), or is there another way ?
Title: Re: RunCommand's allways returning -1 ?!
Post by: Jose on June 16, 2005, 05:32:49 PM
"Maybe I could do 2 load Segs and copy from one to the other (how do I find the end of the code then ?), or is there another way ?"

Forgot the obvious one of copying DigiCam to ram:
:oops: :lol:  :-D  
Title: Re: RunCommand's allways returning -1 ?!
Post by: Jose on June 17, 2005, 04:48:33 PM
All of these problems solved, moving on.... :-D