rcloneExecMain calls rclone with the given environment and arguments. The environment variables are in a single string separated by ; The terminal output is returned as a string.
(env string, args ...string)
| 45 | // The environment variables are in a single string separated by ; |
| 46 | // The terminal output is returned as a string. |
| 47 | func rcloneExecMain(env string, args ...string) (string, error) { |
| 48 | _, found := os.LookupEnv(rcloneTestMain) |
| 49 | if !found { |
| 50 | fs.Fatalf(nil, "Unexpected execution path: %s is missing.", rcloneTestMain) |
| 51 | } |
| 52 | // make a call to self to execute rclone main in a predefined environment (enters TestMain above) |
| 53 | command := exec.Command(os.Args[0], args...) |
| 54 | command.Env = getEnvInitial() |
| 55 | if env != "" { |
| 56 | command.Env = append(command.Env, strings.Split(env, ";")...) |
| 57 | } |
| 58 | out, err := command.CombinedOutput() |
| 59 | return string(out), err |
| 60 | } |
| 61 | |
| 62 | // rcloneEnv calls rclone with the given environment and arguments. |
| 63 | // The environment variables are in a single string separated by ; |
no test coverage detected
searching dependent graphs…