limit time for command
I run c开发者_如何学Pythonommand: run('sleep 1000'). How to limit time ( for example 100) for this command ?
Several points to be precised in your question
- your question is not really a python one, but is more focused on the sleep command, right ? I did not find any
run
command for any standard python package... Or you may want to use python'stime.sleep
instead ?? - I guess you want to set a max value for the sleep command, to be used if the value passed is greater... Is this ok ?
If so, in case you use time.sleep
, there is no way to do what I suppose you want to, as this previous post shows; I did not find any other way to limit the sleep command either via online documentation.
The closest functionality Fabric provides for that would be fabric.operations.prompt. It can validate the input and set default inputs as optional add-ons.
精彩评论