Stopping an AHK script after Timeout #332
-
I've been trying to stop a script if it executes for too long but I have not had success doing so. Even after it times out and calls the future's done callback, the code keeps executing. The execution code: self.ahkExec = AHK(executable_path=os.path.join(self.libPath, 'AutoHotkey64.exe'))
...
future: FutureResult = self.ahkExec.run_script(self.script, blocking=False, timeout=3)
future._fut.add_done_callback(self.handleFuture) The future handler: def handleFuture(self, result: Future):
if result._result == None:
self.logger.warning('Script reached its timeout')
# trying to stop the AHK script here either using ahkExec or the Future result
else:
self.logger.info('Script completed successfully')
self.running = False I have tried using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hmm. Yeah, beyond the included In version 0.x of this library,
I will consider how we can handle this case in a future update. |
Beta Was this translation helpful? Give feedback.
I've made a change in #339 which is released in version
1.8.0
. Processes called withrun_script
are cleaned up immediately after the call tocommunicate
, so this should now be addressed as of this version.