Skip to content

Cannot interrupt robot.run or robot.run_cli and call it again #4514

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rousku opened this issue Oct 20, 2022 · 3 comments
Closed

Cannot interrupt robot.run or robot.run_cli and call it again #4514

rousku opened this issue Oct 20, 2022 · 3 comments

Comments

@rousku
Copy link

rousku commented Oct 20, 2022

If reproduce.py is executing the first robot.run('test.robot') and it is interrupted with ctrl+c, the second robot.run('test.robot') will exit immediately with a Execution terminated by signal error message. Tested with robotframework 5.0.1

reproduce.py

import robot
robot.run('test.robot')
robot.run('test.robot')

test.robot

*** Test Cases ***
Long Sleeping
    Sleep    2600

The issue is that STOP_SIGNAL_MONITOR is still in the "interrupted" state at the second call to robot.run('test.robot') .
That can be worked around with some reloads:

workaround.py

import robot
from importlib import reload
from robot.running import signalhandler, librarykeywordrunner, model

robot.run('test.robot')
reload(signalhandler)
reload(librarykeywordrunner)
reload(model)
robot.run('test.robot')
@oliszymanski
Copy link

or just longer sleep, I'm with you on this one

@pekkaklarck pekkaklarck added this to the v7.3 milestone May 20, 2025
@pekkaklarck
Copy link
Member

pekkaklarck commented May 20, 2025

I had apparently missed this issue. If fixing the issue is easy, I'll do it immediately and it will be included in RF 7.3. If not, I try to get it fixed in RF 7.3.1 or 7.4.

@pekkaklarck
Copy link
Member

Fix was trivial, creating a test was a lot harder. I'll commit both shortly.

A simpler workaround for the issue for those who cannot immediately upgrade to RF 7.3 is this:

import robot
from robot.running.signalhandler import STOP_SIGNAL_MONITOR

robot.run('test.robot')
STOP_SIGNAL_MONITOR._signal_count = 0
robot.run('test.robot')

The above uses internal APIs so it may not work in the future.

@pekkaklarck pekkaklarck changed the title Cannot interrupt robot.run and call it again Cannot interrupt robot.run or robot.run_cli and call it again May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants