Replace deprecated Process.launch() with try run() in ScreenCaptureHelper#1
Merged
afollestad merged 1 commit intoblock:mainfrom Feb 25, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Updates ScreenCaptureHelper.captureSelection() to use Process.run() (with error handling) instead of the deprecated Process.launch() when invoking macOS screencapture, aligning with the file’s other Process call sites.
Changes:
- Replaced deprecated
task.launch()withtry task.run()incaptureSelection() - Added
do/catchto handle launch failures and returnnilon error
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
captureSelection() now throws when screencapture fails to launch (Shell.runCommand returns exitCode -1), so the caller only reaches "Screen capture cancelled." for genuine user cancellations. Launch errors print "Screen capture failed:" and exit(1).
63c3140 to
3b036f7
Compare
afollestad
approved these changes
Feb 25, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
captureSelection()returnednilfor both user cancellation and launch failure, causing the caller to print "Screen capture cancelled." even when screencapture failed to startcaptureSelection()now throws whenShell.runCommandreturnsexitCode -1(launch failure), sonilis reserved for genuine user cancellationsdo/catch: launch failures print "Screen capture failed:" and exit with a non-zero statusTest plan
qrgo --captureand selecting a screen region captures the image and decodes a QR code as expectedlaunchPathto a nonexistent path, runqrgo --capture, verify it prints "Screen capture failed:" and exits non-zero (not "Screen capture cancelled.")