Skip to content

OS Auto run every x seconds stops after pressing button #31

@jfbauer432

Description

@jfbauer432

(originally posted to StreamController/StreamController#244)

Describe the bug

Not sure if this belongs here or under the OS plugin.

I have a Stream Deck mini that has a button with 2 actions

  1. OS run command
  2. OS run command every 10 seconds (output is displayed on button)

The run command every 10 seconds works as expected initially. When I press the button, both commands run as I would expect. However the run every 10 seconds no longer runs after that.

In case it matters, the command name is the same, but the arguments differ.

To Reproduce

Steps to reproduce the behavior:

  1. Create a script that appends the current time and scripts arguments to a file: echo "$(date) -- $@" >> /tmp/foo
  2. Configure a button to have a OS Run Command action. Specify path to script with argument "press". Set Detached to off.
  3. Configure a second action on button with a OS Run Command action. Specify path to script with argument "autorun". Specify Auto Run Every with a value of 10 seconds. Set Detached to off
  4. Run tail -f /tmp/foo (or whatever you called the file the script writes to)
  5. Observe the command running every 10 seconds.
  6. Press button. Observe command called twice with different arguments
  7. Notice that the "autorun" version of the command never runs again (without restarting StreamController)

Expected behavior

The run every x seconds should continue even after pressing the button.

Additional context

Running StreamController 1.5.0-beta.6 also tried at commit StreamController/StreamController@50b1ca6

Additional info

I looked into this and I think I understand the issue. All the function references below are in the OSPlugin actions/RunCommand/RunCommand.py

When the timer fires and it calls self.execute(), it does so with a True argument for restart_timer. And that causes the timer to be re-registered and it runs again the next time the timer goes off. All good.

However, when pressing the button, event_callback() is called and that calls self.execute() with the default False for restart_timer. self.execute() removes the existing timer and runs the command. Because restart_timer was false, the timer does not get restarted.

Commenting out the self.stop_timer() call in execute() fixes the issue in my test case. I don't know if there are any negative consequences to making that change.

Also still exits in OSPlugin updated to version c9af819.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions