Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --pause-on-exit to simplify launchers #4130

Merged
merged 2 commits into from
Oct 11, 2023
Merged

Add --pause-on-exit to simplify launchers #4130

merged 2 commits into from
Oct 11, 2023

Conversation

rom1v
Copy link
Collaborator

@rom1v rom1v commented Jun 29, 2023

scrcpy-console.bat and scrcpy-console.desktop must keep the terminal open if scrcpy fails with an error.

It was implemented in cmd and shell respectively, which added complexity.

Add an option --pause-on-exit in scrcpy to simplify.

Three behaviors are possible:

  • always pause on exit:
    • --pause-on-exit
    • --pause-on-exit=true
  • never pause on exit:
    • (no option)
    • --pause-on-exit=false
  • pause when scrcpy returns with an error (a non-zero exit code):
    • --pause-on-exit=if-error

One problem to consider is that an error in command line parsing could occur before --pause-on-error was taken into account. For that purpose, if getopt did not detect it, this parameter is searched in the whole argv array "manually" (without getopt) so that it works in all cases.

Refs #3817 #3822

Copy link

@ratijas ratijas left a comment

Choose a reason for hiding this comment

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

yea, this sounds like a sensible idea

app/scrcpy.1 Outdated Show resolved Hide resolved
@rom1v rom1v changed the title Add --pause-on-error to simplify launchers Add --pause-on-exit to simplify launchers Jun 30, 2023
rom1v added a commit that referenced this pull request Jun 30, 2023
Add an option to make scrcpy pause on exit.

Three behaviors are possible:
 - always pause on exit:
    --pause-on-exit
    --pause-on-exit=true
 - never pause on exit:
    (no option)
    --pause-on-exit=false
 - pause when scrcpy returns with an error (a non-zero exit code):
    --pause-on-exit=if-error

This is useful to prevent the terminal window from automatically
closing, so that error messages can be read.

Refs #3817 <#3817>
Refs #3822 <#3822>
PR #4130 <#4130>
rom1v added a commit that referenced this pull request Jun 30, 2023
The terminal opened by scrcpy-console (.bat or .desktop) must not close
if scrcpy terminates with an error, so that error messages can be read.

Refs #3817 <#3817>
Refs #3822 <#3822>
PR #4130 <#4130>
@rom1v
Copy link
Collaborator Author

rom1v commented Jun 30, 2023

I refactored to support --pause-on-exit with 3 values: true, false and if-error.

--pause-on-exit is equivalent to --pause-on-exit=true.
If the option is not given, then it is equivalent to --pause-on-exit=false.
In scrcpy-console.bat and scrcpy-console.desktop, --pause-on-exit=if-error is used.

Add an option to make scrcpy pause on exit.

Three behaviors are possible:
 - always pause on exit:
    --pause-on-exit
    --pause-on-exit=true
 - never pause on exit:
    (no option)
    --pause-on-exit=false
 - pause when scrcpy returns with an error (a non-zero exit code):
    --pause-on-exit=if-error

This is useful to prevent the terminal window from automatically
closing, so that error messages can be read.

Refs #3817 <#3817>
Refs #3822 <#3822>
PR #4130 <#4130>
The terminal opened by scrcpy-console (.bat or .desktop) must not close
if scrcpy terminates with an error, so that error messages can be read.

Refs #3817 <#3817>
Refs #3822 <#3822>
PR #4130 <#4130>
@rom1v
Copy link
Collaborator Author

rom1v commented Oct 11, 2023

Let's merge it (I thought it was already done).

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.

None yet

2 participants