Skip to content

camera: Let exec() take the timeout for stopping the running script. - #30

Open
kwagyeman wants to merge 1 commit into
openmv:masterfrom
kwagyeman:fix/exec-stop-timeout
Open

kwagyeman wants to merge 1 commit into
openmv:masterfrom
kwagyeman:fix/exec-stop-timeout

Conversation

@kwagyeman

@kwagyeman kwagyeman commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

exec() stops a running script first, but calls stop() with the default timeout and gives the caller no way to change it. A script that takes longer than that to exit, e.g. a KeyboardInterrupt handler that cleans up, makes exec() raise TimeoutException.

Add timeout to exec() and pass it through to stop(). Default unchanged.

Tested on an N6 with a script that sleeps 2 s in its KeyboardInterrupt handler: exec(script) raises after 1 s as before, exec(script, timeout=6) runs the new script after 2.6 s.

While a KeyboardInterrupt handler is rare, Claude found this while testing a boot.py that takes 2 seconds or longer to finish - you'd hit this in the case of customizing boot.py.

exec() stops a running script first, but called stop() with the default
timeout, so a script that takes longer than that to exit (e.g. a
KeyboardInterrupt handler that cleans up) made exec() raise with no way
to allow for it. Pass a timeout through to stop().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant