positron icon indicating copy to clipboard operation
positron copied to clipboard

Consider adding UI affordance to stop a running process from Viewer pane

Open juliasilge opened this issue 7 months ago • 1 comments

If you have some app running in the terminal that you can see in the Viewer pane, such as an API or a Shiny app, we don't have a way to stop or kill the app from the UI:

Image

You can use Ctrl+C in the terminal to stop the process, but we don't have any UI affordance to do so. We do have a button to "Clear the current URL", but that does not actually stop the app from running. Folks coming from RStudio find the "X" button somewhat alluring, but that hides the secondary side bar and also doesn't stop the app.

juliasilge avatar May 16 '25 21:05 juliasilge

Related to #5344.

jmcphers avatar May 16 '25 21:05 jmcphers

I opened https://github.com/posit-dev/positron/issues/10753 to track adding this functionality to the Shiny and Quarto extensions.

juliasilge avatar Nov 24 '25 19:11 juliasilge

Verified Fixed

Positron Version(s) : 2025.12.0 build 128
OS Version          : macOS Tahoe 26.1

Test scenario(s)

@juliasilge Flawless implementation, everything works as I'd reasonably expect. Please find list of what I verified below.

Note: Please note that the terminal continues running after 'clearing the current URL'. From your PR, it seems like stopping both the Viewer pane and the terminal was intended, but is that still the expected behavior?

URL-driven button visibility

  • Viewer empty → no button.
  • App starting in terminal → no button until Viewer has a URL loaded.
  • Terminal prints URL but Viewer has not rendered it yet → no button.
  • Viewer renders the URL (initial HTML or loading screen visible) → button appears.
  • App may still be initializing after the URL loads → button remains available.

Clearing while app is still loading

  • URL rendered in Viewer → button visible.
  • App continues loading (spinners, partial UI, slow backend) → user clicks Clear.
  • Viewer clears immediately; app process keeps running in terminal.

Clearing after full load

  • URL rendered and app fully loaded.
  • Click Clear → Viewer clears; button disappears.

Clearing when URL loads but app later crashes

  • URL loads → button visible.
  • App backend crashes during or after load.
  • Click Clear → Viewer clears cleanly.

Clearing when app crashes before URL loads

  • App crashes before serving URL → Viewer stays blank or shows error.
  • Button never appears.
  • Clear works normally.

Resurrection after clearing

  • After Clear → Viewer blank.
  • Run app again → when URL loads, button appears and UI begins loading.

Multiple previews

  • Open Preview A → Clear.
  • Open Preview B → Clear.
  • Only the currently loaded URL shows the button once rendered.

Terminal focus irrelevant

  • App running in Terminal 1; Terminal 2 focused.
  • Button appears only when URL loads in Viewer.
  • Clear only affects Viewer; does not stop the process.

@testlabauto I'm creating a task to automate this, just the button clicking and Viewer pane turning blank.

rodrigosf672 avatar Nov 25 '25 12:11 rodrigosf672

Note: Please note that the terminal continues running after 'clearing the current URL'. From your PR, it seems like stopping both the Viewer pane and the terminal was intended, but is that still the expected behavior?

I believe the buttons are doing what is expected now:

  • the button to "Clear the current URL" button clears the URL from the UI but does not stop a process that may be running
  • the new "Interrupt execution" button primarily stops the process but also clears the current URL

We might want to keep our eyes out for user feedback about whether this is confusing or not.

juliasilge avatar Nov 25 '25 15:11 juliasilge

Verified Fixed

Positron Version(s) : 2025.12.0 build 152
OS Version          : macOS Tahoe 26.1

Test scenario(s)

  • 'Interrupt execution' interrupts app in the Terminal (immediately) and in the Viewer pane (1-2 seconds after clicking button), as expected.
Image

rodrigosf672 avatar Nov 27 '25 01:11 rodrigosf672