Answer the question
In order to leave comments, you need to log in
Why is exec.Command not being executed?
Hello, I've encountered some strange problem while executing exec.Command
PGDumpCmd := "pg_dump"
Path := fmt.Sprintf("/tmp/backup_%v_%v.sql.tar.gz", dbname, time.Now().Unix())
options := "-h " + opts.PostgresHost +
" -p " + opts.PostgresPort +
" -U " + opts.PostgresUsername +
" -d " + dbname +
" -w -Fc -f " + Path
log.Printf("[INFO]CMD command %+v opts %+v ", PGDumpCmd, options)
cmd := exec.Command(PGDumpCmd, options)
log.Printf("[INFO]CMD obj %+v ", cmd)
err := cmd.Run()
if err != nil {
log.Printf("[INFO]CMD Error %+v ", err)
}
Answer the question
In order to leave comments, you need to log in
Your team is given only one flag, which is a concatenation of all flags.
You have to send them separately.
exec.Command("pgdump", "-h", opts.PostgresHost, "-p", opts.PostgresPort, "-U", opts.PostgresUsername, "-d", dbname, "-w", "Fc", "-f ", Path)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question