recline.commands.async_command module
Original © NetApp 2024
This is the implementation of an async command for the recline library. It allows for a command to be run in the foreground or background.
- class recline.commands.async_command.AsyncCommand(command, *args, **kwargs)
Bases:
Thread
This is a custom Thread class meant to wrap an asynchronous recline command.
It provides the ability to gather a result as well as put the thread in the foreground or the background of the main REPL thread.
- background() None
Unblock the calling thread and put this thread into the background
- foreground() Any
Block the calling thread until this thread is complete and return the result
Also setup up a signal handler for SIGTSTP so that pressing ctrl+z will put this thread in the background
- run() None
Start the command in an asyncio loop. When it’s complete, the result will be recorded in this thread
- stop(dont_delete=False) None
Kill the command and return control to the main thread
- exception recline.commands.async_command.CommandBackgrounded(job_pid, *args, **kwargs)
Bases:
Exception
When a command is moved from the foreground to the background, this exception is raised to signal the shell.
- exception recline.commands.async_command.CommandCancelled(job_pid, *args, **kwargs)
Bases:
Exception
When a command is cancelled, this is exception is raised to signal the shell
- recline.commands.async_command.set_terminal_echo(enabled=True)