Page 1 of 1

OnExit command line issues

Posted: 04 Sep 2013, 17:24
by stefan
Operator script commands using --OnExit from the command line don't seem to get executed until completion anymore when using SYSTEM, e.g.

Code: Select all

operator.exe --OnExit "-SYSTEM start%20cmd.exe"
If I observe it correctly, when I quit the operator this pops up a command window just for a fraction of a second but then it gets taken down with BCI2000. It used to stay up in version 2. Any thoughts?

Win7, BCI2000 v3.0.5 (rev 4229)

Edit: Noticed that the window that pops up is just the system log window, and it briefly shows a red error message but doesn't stay up long enough to read it

Re: OnExit command line issues

Posted: 10 Sep 2013, 12:49
by stefan
Dug a little deeper, so it looks like in CommandInterpreter::Execute() the string that gets passed in is

Code: Select all

"SYSTEM%20start%%20cmd.exe"
It appears like this string was encoded incorrectly (or twice?) and the command interpreter then fails to tokenize the command and select the appropriate action (system) and it throws a "Cannot make sense of "SYSTEM%20start%%20cmd.exe"" error. In contrast, if I pass in the same script command with --OnConnect, everything works as expected (string passed to Execute() is "SYSTEM start%20cmd.exe"). Something seems to be different in the handling of --OnExit.

Re: OnExit command line issues

Posted: 12 Sep 2013, 15:58
by mellinger
Hi Stefan,

thanks for your concise bug report. The bug has been fixed.

OnExit is indeed handled differently, by the Operator application itself rather than the OperatorLib, which implements the remaining events.

In the meantime, BCI2000 startup batch files have been rewritten to use Operator scripting commands. Using this new feature, you will no longer need to specify scripting commands on the command line, which is supposed to make batch files clearer, and easier to maintain.

Regards,
Juergen

Re: OnExit command line issues

Posted: 13 Sep 2013, 13:09
by stefan
Hi Juergen,

Thanks for the quick fix! Everything is working fine now.

We have a number of somewhat elaborate batch scripts that start up our BCI environment and we are in the process of porting this from BCI2000 v2 on XP to v3 on Win7, so for the moment it was easier for us to keep the old format but I assume in the future we will move to the new Operator scripting commands also.

Thanks again,
Stefan