Skip to content

Background Commands

Compare
Choose a tag to compare
@RobertBlackhart RobertBlackhart released this 04 Jun 21:17
· 27 commits to main since this release

This release adds a new command attribute, background, which is False by default but can be set to True if the command should be run in the background automatically. This can be useful when combined with the atstart attribute to allow for the application to run some long running async method in the background and the interactive repl in the foreground. For instance, perhaps the application is some game server for which you want to implement a set of admin or diagnostic commands. The main loops controlling connections and game flow can happen in a function like this:

@recline.command(atstart=True, background=True)
async def main_loop():
    ...

and then the rest of the REPL can still be dedicated to running commands in the foreground.