| OLD | NEW |
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 | 2 |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 NAME=org.chromium.chromoting | 7 NAME=org.chromium.chromoting |
| 8 HOST_BUNDLE_NAME=@@HOST_BUNDLE_NAME@@ | 8 HOST_BUNDLE_NAME=@@HOST_BUNDLE_NAME@@ |
| 9 PREFPANE_BUNDLE_NAME=@@PREFPANE_BUNDLE_NAME@@ | 9 PREFPANE_BUNDLE_NAME=@@PREFPANE_BUNDLE_NAME@@ |
| 10 CONFIG_DIR=/Library/PrivilegedHelperTools | 10 CONFIG_DIR=/Library/PrivilegedHelperTools |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 sleep "$relaunch_in" | 75 sleep "$relaunch_in" |
| 76 else | 76 else |
| 77 # If the host ran for long enough, reset the crash counter. | 77 # If the host ran for long enough, reset the crash counter. |
| 78 host_failure_count=0 | 78 host_failure_count=0 |
| 79 fi | 79 fi |
| 80 fi | 80 fi |
| 81 | 81 |
| 82 # Execute the host asynchronously and forward signals to it. | 82 # Execute the host asynchronously and forward signals to it. |
| 83 trap "handle_signal" $SIGNAL_LIST | 83 trap "handle_signal" $SIGNAL_LIST |
| 84 host_start_time=$(date +%s) | 84 host_start_time=$(date +%s) |
| 85 "$HOST_EXE" --host-config="$CONFIG_FILE" & | 85 "$HOST_EXE" --host-config="$CONFIG_FILE" \ |
| 86 --ssh-auth-sockname="/tmp/chromoting.$USER.ssh_auth_sock" & |
| 86 HOST_PID="$!" | 87 HOST_PID="$!" |
| 87 | 88 |
| 88 # Wait for the host to return and process its exit code. | 89 # Wait for the host to return and process its exit code. |
| 89 while true; do | 90 while true; do |
| 90 wait "$HOST_PID" | 91 wait "$HOST_PID" |
| 91 EXIT_CODE="$?" | 92 EXIT_CODE="$?" |
| 92 if [[ $SIGNAL_WAS_TRAPPED -eq 1 ]]; then | 93 if [[ $SIGNAL_WAS_TRAPPED -eq 1 ]]; then |
| 93 # 'wait' returned as the result of a trapped signal and the exit code is | 94 # 'wait' returned as the result of a trapped signal and the exit code is |
| 94 # the signal that was trapped + 128. Forward the signal to the host. | 95 # the signal that was trapped + 128. Forward the signal to the host. |
| 95 SIGNAL_WAS_TRAPPED=0 | 96 SIGNAL_WAS_TRAPPED=0 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 # stdin until the pipe is broken. | 153 # stdin until the pipe is broken. |
| 153 cat 2>/dev/null || true | 154 cat 2>/dev/null || true |
| 154 open "$PREF_PANE_BUNDLE" | 155 open "$PREF_PANE_BUNDLE" |
| 155 elif [[ "$1" = "--run-from-launchd" ]]; then | 156 elif [[ "$1" = "--run-from-launchd" ]]; then |
| 156 echo Host started for user $USER at $"$(date)" | 157 echo Host started for user $USER at $"$(date)" |
| 157 run_host | 158 run_host |
| 158 else | 159 else |
| 159 echo $$ | 160 echo $$ |
| 160 exit 1 | 161 exit 1 |
| 161 fi | 162 fi |
| OLD | NEW |