ldez/traefik-certs-dumper

Unable to use arguments containing spaces in --post-hook

hermlon opened this issue · 1 comments

parts := strings.Fields(os.ExpandEnv(command))
output, err := exec.CommandContext(ctxCmd, parts[0], parts[1:]...).CombinedOutput()

Because the string.Fields function splits at every single space it is impossible to execute a command with an argument containing spaces. For example --post-hook "mkdir t\ est" will create two direcories t\ and est instead of t est because both are treated as separate arguments.
Would it be a bad practice to just always execute /bin/sh and pass the whole command as a single argument?

ldez commented

Hello,

I recommend to use a script instead of a simple command line.