GODT-2150: fixed initial implementation that filtered --no-window in gui instead of bridge.
This commit is contained in:
@ -108,7 +108,7 @@ void parseCommandLineArguments(int argc, char *argv[], QStringList& args, QStrin
|
|||||||
{
|
{
|
||||||
outNoWindow = true;
|
outNoWindow = true;
|
||||||
}
|
}
|
||||||
else if (arg == launcherFlag)
|
if (arg == launcherFlag)
|
||||||
{
|
{
|
||||||
args.append(arg);
|
args.append(arg);
|
||||||
launcher = QString::fromLocal8Bit(argv[++i]);
|
launcher = QString::fromLocal8Bit(argv[++i]);
|
||||||
|
|||||||
@ -77,7 +77,7 @@ func (restarter *Restarter) Restart() {
|
|||||||
//nolint:gosec
|
//nolint:gosec
|
||||||
cmd := execabs.Command(
|
cmd := execabs.Command(
|
||||||
restarter.exe,
|
restarter.exe,
|
||||||
xslices.Join(removeFlagWithValue(os.Args[1:], "parent-pid"), restarter.flags)...,
|
xslices.Join(removeFlagWithValue(removeFlag(os.Args[1:], "no-window"), "parent-pid"), restarter.flags)...,
|
||||||
)
|
)
|
||||||
|
|
||||||
l := logrus.WithFields(logrus.Fields{
|
l := logrus.WithFields(logrus.Fields{
|
||||||
@ -156,3 +156,7 @@ func removeFlagWithValue(argList []string, flag string) []string {
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func removeFlag(argList []string, flag string) []string {
|
||||||
|
return xslices.Filter(argList, func(arg string) bool { return (arg != "-"+flag) && (arg != "--"+flag) })
|
||||||
|
}
|
||||||
|
|||||||
@ -41,3 +41,20 @@ func TestRemoveFlagWithValue(t *testing.T) {
|
|||||||
require.Equal(t, removeFlagWithValue(tt.argList, tt.flag), tt.expected)
|
require.Equal(t, removeFlagWithValue(tt.argList, tt.flag), tt.expected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRemoveFlag(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
argList []string
|
||||||
|
flag string
|
||||||
|
expected []string
|
||||||
|
}{
|
||||||
|
{[]string{}, "b", []string{}},
|
||||||
|
{[]string{"-a", "-b", "-c"}, "b", []string{"-a", "-c"}},
|
||||||
|
{[]string{"-a", "--b", "-b"}, "b", []string{"-a"}},
|
||||||
|
{[]string{"-a", "-c"}, "b", []string{"-a", "-c"}},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
require.Equal(t, removeFlag(tt.argList, tt.flag), tt.expected)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user