From 23f3f06cf11807a5ac915e39dc3b007e4c3e1d2e Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 2 Aug 2019 14:43:32 +0200 Subject: [PATCH] Suppress arguments for windows snoretoast commands --- pmctl/run.go | 4 ++++ pmctl/show.go | 6 +++++- pmctl/snoretoast_windows.go | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pmctl/run.go b/pmctl/run.go index 76fe8055..f2d625ed 100644 --- a/pmctl/run.go +++ b/pmctl/run.go @@ -28,6 +28,7 @@ var ( type Options struct { Identifier string // component identifier ShortIdentifier string // populated automatically + SuppressArgs bool // do not use any args AllowDownload bool // allow download of component if it is not yet available AllowHidingWindow bool // allow hiding the window of the subprocess NoOutput bool // do not use stdout/err if logging to file is available (did not fail to open log file) @@ -134,6 +135,9 @@ func run(cmd *cobra.Command, opts *Options) (err error) { return cmd.Help() } args = os.Args[3:] + if opts.SuppressArgs { + args = nil + } // adapt identifier if onWindows { diff --git a/pmctl/show.go b/pmctl/show.go index 19985b47..9ea0934f 100644 --- a/pmctl/show.go +++ b/pmctl/show.go @@ -53,7 +53,8 @@ var showNotifier = &cobra.Command{ Short: "Show command to run the Portmaster Notifier", RunE: func(cmd *cobra.Command, args []string) error { return show(cmd, &Options{ - Identifier: "notifier/portmaster-notifier", + Identifier: "notifier/portmaster-notifier", + SuppressArgs: true, }) }, FParseErrWhitelist: cobra.FParseErrWhitelist{ @@ -69,6 +70,9 @@ func show(cmd *cobra.Command, opts *Options) error { return cmd.Help() } args = os.Args[3:] + if opts.SuppressArgs { + args = nil + } // adapt identifier if onWindows { diff --git a/pmctl/snoretoast_windows.go b/pmctl/snoretoast_windows.go index 6839edf7..75421253 100644 --- a/pmctl/snoretoast_windows.go +++ b/pmctl/snoretoast_windows.go @@ -12,7 +12,8 @@ var showSnoreToast = &cobra.Command{ Short: "Show command to run the Notifier component SnoreToast", RunE: func(cmd *cobra.Command, args []string) error { return show(cmd, &Options{ - Identifier: "notifier/portmaster-snoretoast", + Identifier: "notifier/portmaster-snoretoast", + SuppressArgs: true, }) }, FParseErrWhitelist: cobra.FParseErrWhitelist{ @@ -29,6 +30,7 @@ var runSnoreToast = &cobra.Command{ Identifier: "notifier/portmaster-snoretoast", AllowDownload: false, AllowHidingWindow: true, + SuppressArgs: true, }) }, FParseErrWhitelist: cobra.FParseErrWhitelist{