Skip to content

Commit

Permalink
Do not quit on cleanup configuration failure
Browse files Browse the repository at this point in the history
Cleanup is used for some options like --show-touches to restore the
state on exit.

If the configuration fails, do not crash the whole process. Just log an
error.

PR #2802 <#2802>
  • Loading branch information
rom1v committed Nov 18, 2021
1 parent 411bb0d commit c29a0bf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/src/main/java/com/genymobile/scrcpy/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ private Server() {
// not instantiable
}

private static void initAndCleanUp(Options options) throws IOException {
private static void initAndCleanUp(Options options) {
boolean mustDisableShowTouchesOnCleanUp = false;
int restoreStayOn = -1;
if (options.getShowTouches() || options.getStayAwake()) {
Expand Down Expand Up @@ -51,7 +51,11 @@ private static void initAndCleanUp(Options options) throws IOException {
}
}

CleanUp.configure(options.getDisplayId(), restoreStayOn, mustDisableShowTouchesOnCleanUp, true, options.getPowerOffScreenOnClose());
try {
CleanUp.configure(options.getDisplayId(), restoreStayOn, mustDisableShowTouchesOnCleanUp, true, options.getPowerOffScreenOnClose());
} catch (IOException e) {
Ln.e("Could not configure cleanup", e);
}
}

private static void scrcpy(Options options) throws IOException {
Expand Down

0 comments on commit c29a0bf

Please sign in to comment.