diff options
author | Jason Cox <me@jasoncarloscox.com> | 2024-02-15 15:35:25 -0500 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-02-19 20:37:37 +0100 |
commit | 673ae1bbc760ad96664e84d54d373839d9ae2c57 (patch) | |
tree | 7438bdebf466c61724b54196ca0adbef157b94c4 /lib/ipc/receive.go | |
parent | 5781f1e6b49025e2909c4b87912d6c9dd7256286 (diff) | |
download | aerc-673ae1bbc760ad96664e84d54d373839d9ae2c57.tar.gz |
ipc: accept verbatim commands
When aerc receives a command over IPC, it quotes the arguments before
passing them on to the internal command parser. In many cases, the
parser interprets the quotes, and the command runs with the arguments
exactly as they were specified in the shell. In some cases, though, the
quotes are not interpreted and the additional quotes can cause the
command to fail. Simply eliminating the addition of quotes is not
possible because some commands need them.
Allow a command and its arguments to be specified as a single argument
in the shell. In that case, pass that argument verbatim to the internal
command parser so that it is interpreted exactly as if it had been typed
directly in aerc's command line.
Link: https://lists.sr.ht/~rjarry/aerc-devel/%3C20240203085541.27416-2-contact%40willowbarraco.fr%3E
Changelog-added: Execute IPC commands verbatim by providing the
command and its args as a single argument in the shell.
Cc: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Jason Cox <me@jasoncarloscox.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib/ipc/receive.go')
-rw-r--r-- | lib/ipc/receive.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/ipc/receive.go b/lib/ipc/receive.go index e2fffaf0..79618f50 100644 --- a/lib/ipc/receive.go +++ b/lib/ipc/receive.go @@ -128,8 +128,11 @@ func (as *AercServer) handleMessage(req *Request) *Response { Error: "command rejected: IPC is disabled", } } - cmdline := opt.QuoteArgs(req.Arguments...) - err = as.handler.Command(cmdline.String()) + cmdline := req.Arguments[0] + if len(req.Arguments) > 1 { + cmdline = opt.QuoteArgs(req.Arguments...).String() + } + err = as.handler.Command(cmdline) if err != nil { return &Response{Error: err.Error()} } |