mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-21 17:46:48 +00:00
Revert "GODT-2039: bridge monitors bridge-gui via its PID."
This reverts commit 3b9a3aaad2.
This commit is contained in:
@ -20,7 +20,6 @@ package base
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/sys/execabs"
|
||||
@ -39,8 +38,6 @@ func (b *Base) restartApp(crash bool) error {
|
||||
args = os.Args[1:]
|
||||
}
|
||||
|
||||
args = removeFlagWithValue(args, FlagParentPID)
|
||||
|
||||
if b.launcher != "" {
|
||||
args = forceLauncherFlag(args, b.launcher)
|
||||
}
|
||||
@ -88,30 +85,6 @@ func incrementRestartFlag(args []string) []string {
|
||||
return res
|
||||
}
|
||||
|
||||
// removeFlagWithValue removes a flag that requires a value from a list of command line parameters.
|
||||
// The flag can be of the following form `-flag value`, `--flag value`, `-flag=value` or `--flags=value`.
|
||||
func removeFlagWithValue(argList []string, flag string) []string {
|
||||
var result []string
|
||||
|
||||
for i := 0; i < len(argList); i++ {
|
||||
arg := argList[i]
|
||||
// "detect the parameter form "-flag value" or "--paramName value"
|
||||
if (arg == "-"+flag) || (arg == "--"+flag) {
|
||||
i++
|
||||
continue
|
||||
}
|
||||
|
||||
// "detect the form "--flag=value" or "--flag=value"
|
||||
if strings.HasPrefix(arg, "-"+flag+"=") || (strings.HasPrefix(arg, "--"+flag+"=")) {
|
||||
continue
|
||||
}
|
||||
|
||||
result = append(result, arg)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// forceLauncherFlag replace or add the launcher args with the one set in the app.
|
||||
func forceLauncherFlag(args []string, launcher string) []string {
|
||||
res := append([]string{}, args...)
|
||||
|
||||
Reference in New Issue
Block a user