Print 7za/unrar output on failure

This commit is contained in:
Alex Yatskov 2023-11-04 19:11:34 -07:00
parent 777d0766ca
commit 971d7d41e0

View File

@ -48,7 +48,8 @@ func Compress(archPath, contentDir string) error {
) )
log.Printf("compressing %s...", archPath) log.Printf("compressing %s...", archPath)
if err := toolCmd.Run(); err != nil { if output, err := toolCmd.CombinedOutput(); err != nil {
fmt.Println(string(output))
return errors.Join(fmt.Errorf("compression of %s failed", archPath), err) return errors.Join(fmt.Errorf("compression of %s failed", archPath), err)
} }
@ -91,7 +92,8 @@ func Decompress(archPath string, allocator *TempDirAllocator) (string, error) {
toolCmd.Dir = contentDir toolCmd.Dir = contentDir
log.Printf("decompressing %s...", archPath) log.Printf("decompressing %s...", archPath)
if err := toolCmd.Run(); err != nil { if output, err := toolCmd.CombinedOutput(); err != nil {
fmt.Println(string(output))
return "", errors.Join(fmt.Errorf("decompression of %s failed", archPath), err) return "", errors.Join(fmt.Errorf("decompression of %s failed", archPath), err)
} }