[REV] Optimize to execute multiple commands.

This commit is contained in:
Zhang Jiajun 2018-05-10 19:19:11 +08:00
parent bda62f34c5
commit 75c0fe0e03

View File

@ -475,7 +475,7 @@ func (i *ExportApp) generateTarFile() error {
// /grdata/export-app/myapp-1.0 -> myapp-1.0
baseName := path.Base(i.SourceDir)
// 打包整个目录为tar包
err := exec.Command(fmt.Sprintf("cd %s ; rm -rf %s.tar ; tar -cf %s.tar %s", dirName, baseName, baseName, baseName)).Run()
err := exec.Command(fmt.Sprintf("{ cd %s ; rm -rf %s.tar ; tar -cf %s.tar %s ; }", dirName, baseName, baseName, baseName)).Run()
if err != nil {
i.Logger.Error("打包应用失败", map[string]string{"step": "export-app", "status": "failure"})
logrus.Errorf("Failed to create tar file for group key %s: %v", i.GroupKey, err)