Page 1 of 1

shell calls

Posted: Mon Oct 10, 2011 10:48 am
by John
what is the right way to disable timeout on an individual shell call? (to avoid the 4591) with out setting shell limit in the brconfig.sys?

I tried SY -t0 but that made it timeout immediately.

-john

Posted: Tue Oct 11, 2011 2:13 pm
by John
currently i'm using -t9999 - which I believe will work for 2.7 hours, but I'd really like them to be able to leave this open all day if they want.

Posted: Wed Oct 12, 2011 6:35 am
by Gabriel
Instead of calling your program directly, call a batch file.

Your batch file should call the program you want, then create an output file indicating that its done.

Your BR program should call the batch file with the -C parameter, so that it doesn't wait at all and also doesn't give an error. Right after calling the batch file, you loop, waiting until the "done indicator" file appears telling you its done.

This is just an idea, I'm just brainstorming here, I haven't tried it. It seems like it would work but it may not. It would be nice if there is a parameter we're just not aware of to make the System call not ever timeout. (have you tried -1)?

Gabriel

Posted: Wed Oct 12, 2011 8:41 am
by John
I believe your batch file method should work. I'm surprised that there isn't a way to do this in BR! without having to write another program in a different language (batch).

Also I tried the -t-1 but it gave an error 4501 (invalid shell call)

Thanks for the tip.

Posted: Wed Oct 12, 2011 3:06 pm
by David Bohlke
John, your batch file (with a .bat extension) can be as simple as:
path\file.exe (Whatever your called program is)
echo >testdone (or whatever file name you would test for)
In your BR program, while looping to check for file "testdone" add a SLEEP(n) to pause it for n seconds so it doesn't chew up processor time in a hard loop. Also need to delete file "testdone" in the BR program after waiting for it.

Posted: Thu Oct 13, 2011 7:07 am
by gordon
Taken from the BR_CS.TXT file in Dll_Distr/DOC:
SHELL LIMIT 9999
Sets default timeout - maximum seconds to wait for a child process.
If not specified, this value is set to 240 seconds. Minus one ( -1 )
indicates never timeout unless -t is specified in the System command.
Please note that the -1 refers to the SHELL LIMIT statement, not the -t parameter.
The -t is mentioned as an exception to the "no limit" setting.

Posted: Thu Oct 13, 2011 7:09 am
by Gabriel
So what is the appropriate code to use if you don't want to change the timeout values on any other shell calls, but you want just one specific shell call to have an infinite wait time?

Posted: Thu Oct 13, 2011 12:28 pm
by John
which is exactly what I'd like to do (what gabriel said)

Posted: Thu Oct 13, 2011 12:45 pm
by bluesfannoz
Gabe and John you already answered your own question...

-C gives you a shell call without any timeout so there is no need for a parameter on the -t flag.

If your needing BR to know when you exited the shell. You have to setup a trigger like Gabe mentioned of something to look for in BR when the shell completes, that can be a file or an ENV$ variable changed or another of different triggers. Since we created our own EXE's that we call outside BR we built in a stshell.tmp file that is set to read only and BR watches until it can successfully write to stshell.tmp without a 4205 error. In our EXE it locks stshell.tmp when it first executes and unlocks it when it exits. Thus the 4205 error when BR attempts to write to it.

Posted: Thu Oct 13, 2011 1:23 pm
by Gabriel
John, if you're not using shell default currently it may be ok to change it to -1. If you are using it, you may be able to temporarily override it with execute config shelldefault -1 then set it back when you're done.