diff --git a/backend/app/service/snapshot.go b/backend/app/service/snapshot.go index ebb80ddc7..c3cd0e196 100644 --- a/backend/app/service/snapshot.go +++ b/backend/app/service/snapshot.go @@ -884,9 +884,10 @@ func updateRollbackStatus(id uint, status string, message string) { } func cpBinary(src []string, dst string) error { - stderr, err := cmd.Exec(fmt.Sprintf("\\cp -f %s %s", strings.Join(src, " "), dst)) + global.LOG.Debugf(fmt.Sprintf("\\cp -f %s %s", strings.Join(src, " "), dst)) + stdout, err := cmd.Exec(fmt.Sprintf("\\cp -f %s %s", strings.Join(src, " "), dst)) if err != nil { - return errors.New(stderr) + return fmt.Errorf("cp file failed, stdout: %v, err: %v", stdout, err) } return nil } diff --git a/backend/app/service/upgrade.go b/backend/app/service/upgrade.go index 2a3daf0d7..952831032 100644 --- a/backend/app/service/upgrade.go +++ b/backend/app/service/upgrade.go @@ -132,25 +132,25 @@ func (u *UpgradeService) Upgrade(req dto.Upgrade) error { global.LOG.Info("backup original data successful, now start to upgrade!") if err := cpBinary([]string{tmpDir + "/1panel"}, "/usr/local/bin/1panel"); err != nil { - u.handleRollback(fileOp, originalDir, 1) global.LOG.Errorf("upgrade 1panel failed, err: %v", err) + u.handleRollback(fileOp, originalDir, 1) return } if err := cpBinary([]string{tmpDir + "/1pctl"}, "/usr/local/bin/1pctl"); err != nil { - u.handleRollback(fileOp, originalDir, 2) global.LOG.Errorf("upgrade 1pctl failed, err: %v", err) + u.handleRollback(fileOp, originalDir, 2) return } if _, err := cmd.Execf("sed -i -e 's#BASE_DIR=.*#BASE_DIR=%s#g' /usr/local/bin/1pctl", global.CONF.System.BaseDir); err != nil { - u.handleRollback(fileOp, originalDir, 2) global.LOG.Errorf("upgrade basedir in 1pctl failed, err: %v", err) + u.handleRollback(fileOp, originalDir, 2) return } if err := cpBinary([]string{tmpDir + "/1panel.service"}, "/etc/systemd/system/1panel.service"); err != nil { - u.handleRollback(fileOp, originalDir, 3) global.LOG.Errorf("upgrade 1panel.service failed, err: %v", err) + u.handleRollback(fileOp, originalDir, 3) return }