Closed sohocoke closed 6 years ago
Hi, and thank you for the suggestion, but this functionality is not specific to running shell commands so I don't think it's a good fit for this project. SwiftShell already supports terminating a running command:
let eternalCommand = runAsync("...")
// ...
eternalCommand.stop()
So you can call eternalCommand.stop()
from any delayed or repeating code block.
Sorry, forgot that functionality has not been released yet. But it is available in the latest beta 4.1.0-beta.2.
Ah nice, that sounds like exactly what I need. Thanks!
I’m looking for a way to abort execution of a command based on a timeout, and ideally, a more generic condition that is periodically checked.
Since it appears this is not currently possible, I’d like to ask what interface change to add this feature would be best.
Off the cuff, I can think of changing
#run(…)
to have a closure argument() -> Bool
that defaults to{ return false }
. I could then implement a timeout using some suitable timer primitive, ideally available across platforms (so probably not NSTimer / GCD?).Before I roll up my sleeves I’d love to hear how this sounds.