Skip to content

Commit

Permalink
Merge pull request #174 from sol-eng/fix-quarto-command-log
Browse files Browse the repository at this point in the history
Fix quarto command log
  • Loading branch information
tnederlof authored Jun 13, 2023
2 parents c6304ed + e1dddbc commit 3a6dc0c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions internal/quarto/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/samber/lo"
log "github.com/sirupsen/logrus"
"github.com/sol-eng/wbi/internal/config"
cmdlog "github.com/sol-eng/wbi/internal/logging"
"github.com/sol-eng/wbi/internal/system"
)

Expand Down Expand Up @@ -53,10 +54,16 @@ func DownloadAndInstallQuarto(quartoVersion string, osType config.OperatingSyste
return fmt.Errorf("DownloadFileQuarto: %w", err)
}
// Install Quarto
err = installQuarto(installerPath, osType, quartoVersion)
err = installQuarto(installerPath, osType, quartoVersion, true)
if err != nil {
return fmt.Errorf("InstallQuarto: %w", err)
}
// save to command log
quartoPath := fmt.Sprintf("/opt/quarto/%s", quartoVersion)
cmdlog.Info("curl -o quarto.tar.gz -L " + quartoURL)
cmdlog.Info("mkdir -p " + quartoPath)
cmdlog.Info(fmt.Sprintf(`tar -zxvf quarto.tar.gz -C "%s" --strip-components=1`, quartoPath))
cmdlog.Info("rm quarto.tar.gz")
return nil
}

Expand Down Expand Up @@ -109,7 +116,7 @@ func downloadFileQuarto(url string, version string, osType config.OperatingSyste
}

// Installs Quarto
func installQuarto(filepath string, osType config.OperatingSystem, version string) error {
func installQuarto(filepath string, osType config.OperatingSystem, version string, save bool) error {
// create the /opt/quarto directory if it doesn't exist
path := fmt.Sprintf("/opt/quarto/%s", version)
if _, err := os.Stat(path); os.IsNotExist(err) {
Expand All @@ -121,7 +128,7 @@ func installQuarto(filepath string, osType config.OperatingSystem, version strin

installCommand := fmt.Sprintf(`tar -zxvf "%s" -C "%s" --strip-components=1`, filepath, path)

err := system.RunCommand(installCommand, false, 0, true)
err := system.RunCommand(installCommand, false, 0, false)
if err != nil {
return fmt.Errorf("the command '%s' failed to run: %w", installCommand, err)
}
Expand Down

0 comments on commit 3a6dc0c

Please sign in to comment.