Author Topic: [v1.7.5] Command.Execute() fails subsequent execution  (Read 2854 times)

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
[v1.7.5] Command.Execute() fails subsequent execution
« on: April 04, 2019, 05:21:18 PM »
When an inline function is used to execute another command, if the "Allow other commands to execute while this one is running" option is not checked in the calling command, execution will only occur once, and subsequent attempts will fail with this log entry:
"Command canceled: Another command is not allowing others to execute (canceled: command name)."

If the "Allow other commands to execute while this one is running" option is checked, the target command can be executed as expected.

If the "Allow other commands to execute while this one is running" option is not checked, but the inline function is executed synchronously(using the "Wait for the inline function to finish before continuing" option), executing another command will fail even the first time the function is used.
This is also the behavior if the "WaitForReturn" argument of the "Execute()" method is set to true.


If the inline function is run from the editor directly, the method will work regardless of command settings.
EDIT#4: Unless a command with the "Allow other commands to execute while this one is running" option unchecked is already running, as you'd expect.


EDIT: Also applies up to v1.7.5.4

EDIT#2: Also applies to v1.7.5.8

EDIT#3: Also applies to v1.8.3.21
« Last Edit: March 07, 2020, 09:17:32 PM by Pfeil »

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2827
Re: [v1.7.5] Command.Execute() fails subsequent execution
« Reply #1 on: March 07, 2020, 07:39:50 PM »
I think what is happening here is that the calling command is competing with the inline's executed command, both being, 'top-level' (and then all the blocking).  I think if you execute the inline function's command using the, 'AsSubcommand' parameter, this should work ok:

VA.Command.Execute("my command", true, true);

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: [v1.7.5] Command.Execute() fails subsequent execution
« Reply #2 on: March 07, 2020, 08:34:52 PM »
Absolutely, but the question is why does it still execute exactly once within the same session?

Adding a pause to the calling command does not change anything, which suggests it's not a timing issue.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2827
Re: [v1.7.5] Command.Execute() fails subsequent execution
« Reply #3 on: March 07, 2020, 09:09:13 PM »
Ah - I see.  Not sure at this point.  I've got some items I can try, but being this close to the next release might cause unforeseen issues.