Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/openmv/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,15 @@ def stop(self, timeout=None):
raise TimeoutException("Timeout waiting for the script to stop")

@retry_if_failed
def exec(self, script):
"""Write and execute a script"""
def exec(self, script, timeout=None):
"""Write and execute a script.

A running script is stopped first; timeout is how long to wait for
it to exit (default: the transport timeout).
"""
# Stop the running script first
if self.read_status()["stdin"]:
self.stop()
self.stop(timeout=timeout)
stdin_id = self.get_channel(name="stdin")
# Reset script buffer
self._channel_ioctl(stdin_id, ChannelIOCTL.STDIN_RESET)
Expand Down
Loading