-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
printer: enhance ephemeral message handover after stop()
In craft tools, emit.pause() is used to allow external processes to take control the terminal. Specifically, in LXD and Multipass builds the real build host is another instance of the same craft tool that launched the build, running inside the sandbox. In order to have a seamless handover between the local and sandbox output of the craft tool instances, the concepts of permanent and ephemeral messages must be honored when the terminal transitions to or from the craft tool running inside the sandbox. Example: emit.progress("Starting LXD...") : with emit.pause(): instance.execute_run(...) In the example above, execute_run start another instance of the craft tool, and continues emitting 'progress' (ephemeral) messages. The expected behaviour is that the progress messages from the sandbox environment will replace the last progress message from the original craft tool instance. This patch enhances the printer stop() code to detect if the last print is ephemeral or permanent. The new behaviour only affect the case where the last message before emit.pause() or emit.ended_ok() is of ephemeral type, in which case no newline is flushed on the terminal. This allows the new process to rewrite the previous line. It is of course the programmer's responsibility to use ephemeral messages wisely before pausing or exiting the emitter engine.
- Loading branch information
Showing
2 changed files
with
116 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters