aboutsummaryrefslogtreecommitdiffstats
path: root/commands/compose/send.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-10-18 10:24:36 +0200
committerRobin Jarry <robin@jarry.cc>2023-10-28 19:25:13 +0200
commit3f3f5929519195ad018b50733820ac88edc5373a (patch)
tree47be83c8a3854e87c579ed20c37e90f104a39031 /commands/compose/send.go
parentabe228b14d97d8d47e8ff4406de387fac45cfe68 (diff)
downloadaerc-3f3f5929519195ad018b50733820ac88edc5373a.tar.gz
treewide: replace shlex.Split with opt.SplitArgs
Replace the remaining shlex.Split calls with opt.SplitArgs. Remove dependency to shlex. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
Diffstat (limited to 'commands/compose/send.go')
-rw-r--r--commands/compose/send.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/commands/compose/send.go b/commands/compose/send.go
index 6f905628..1047ebad 100644
--- a/commands/compose/send.go
+++ b/commands/compose/send.go
@@ -12,7 +12,6 @@ import (
"github.com/emersion/go-sasl"
"github.com/emersion/go-smtp"
- "github.com/google/shlex"
"github.com/pkg/errors"
"git.sr.ht/~rjarry/aerc/app"
@@ -23,6 +22,7 @@ import (
"git.sr.ht/~rjarry/aerc/log"
"git.sr.ht/~rjarry/aerc/models"
"git.sr.ht/~rjarry/aerc/worker/types"
+ "git.sr.ht/~rjarry/go-opt"
"github.com/emersion/go-message/mail"
"golang.org/x/oauth2"
)
@@ -271,10 +271,7 @@ type sendCtx struct {
}
func newSendmailSender(ctx sendCtx) (io.WriteCloser, error) {
- args, err := shlex.Split(ctx.uri.Path)
- if err != nil {
- return nil, err
- }
+ args := opt.SplitArgs(ctx.uri.Path)
if len(args) == 0 {
return nil, fmt.Errorf("no command specified")
}
@@ -286,6 +283,7 @@ func newSendmailSender(ctx sendCtx) (io.WriteCloser, error) {
args = append(args[1:], rs...)
cmd := exec.Command(bin, args...)
s := &sendmailSender{cmd: cmd}
+ var err error
s.stdin, err = s.cmd.StdinPipe()
if err != nil {
return nil, errors.Wrap(err, "cmd.StdinPipe")