remove tmpfile if no diff changes present

Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
Christian Richter
2024-11-13 13:06:13 +01:00
parent 80861d3a01
commit d1bfb73f96

View File

@@ -86,6 +86,10 @@ func writePatch(configPath string, yamlOutput []byte) error {
cmd := exec.Command("diff", "-u", path.Join(configPath, configFilename), tmpFile)
stdout, err := cmd.Output()
if err == nil {
err = os.Remove(tmpFile)
if err != nil {
return err
}
fmt.Println("no changes, your config is up to date")
return nil
}