Skip to content

New option --exit-when-done closes the terminal interface when rendering is done - #356

Open
NejcS wants to merge 1 commit into
mainfrom
feat/exit-when-done
Open

NejcS wants to merge 1 commit into
mainfrom
feat/exit-when-done

Conversation

@NejcS

@NejcS NejcS commented Nov 3, 2026

Copy link
Copy Markdown
Member

The renderer can now close its terminal interface by itself when rendering stops.

What the user does

The user adds --exit-when-done to the render command. When rendering stops, the terminal interface closes at once and the user is back in the shell. This happens for a render that succeeded and for a render that failed.

Without the option nothing changes: the interface stays open until the user presses Enter.

The result is still visible

The render summary is printed to the terminal after the interface closes, as it is today. It says if the render succeeded, failed or was canceled, and it shows the render id, the input file, the folder with the generated code, and the credits used. An error message is printed below it.

Headless rendering

Headless rendering always ends by itself, so the option changes nothing there.

Where the option can be set

On the command line, or in config.yaml as exit-when-done: true. The command line wins.

No database changes. No other pull request or release is needed.

The new option --exit-when-done closes the terminal interface as soon as
rendering stops, for success and for failure. Without it the interface
stays open until the user presses Enter.

The render summary still goes to the terminal after the interface closes,
so the user sees the outcome. Headless rendering is not affected, because
it always ends by itself.
@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 53 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: eeabac48-eb4b-40e7-b17a-af069a113375
Commits

Reviewing files that changed from the base of the PR and between cf96d0f and b35bc0e.

Files selected for processing: 6
  • docs/plain2code_cli.md
  • plain2code.py
  • plain2code_arguments.py
  • tests/test_exit_when_done.py
  • tests/test_terminal_attachment.py
  • tui/plain2code_tui.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@NejcS
NejcS requested a review from VitjanZ November 3, 2026 07:33

@VitjanZ VitjanZ left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread tui/plain2code_tui.py
message to the app thread by itself.
"""
if self.exit_when_done:
self.exit()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling exit() like this can cause race conditions - app can exit before the last log lines are drawn in TUI. Tested locally I sometimes got an ugly MountError traceback (running --exit-when-done with --force-render on the hello world example in a loop -- try it yourself)

Instead let's queue the exit after the pending log drawing with self.call_later(self.exit)

@NejcS @VitjanZ

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants