@@ -21,14 +21,6 @@ import (
2121 "encoding/hex"
2222 "errors"
2323 "fmt"
24- "github.com/JetBrains/qodana-cli/v2025/platform"
25- "github.com/JetBrains/qodana-cli/v2025/platform/msg"
26- "github.com/JetBrains/qodana-cli/v2025/platform/product"
27- "github.com/JetBrains/qodana-cli/v2025/platform/strutil"
28- "github.com/JetBrains/qodana-cli/v2025/platform/utils"
29- cp "github.com/otiai10/copy"
30- "github.com/pterm/pterm"
31- log "github.com/sirupsen/logrus"
3224 "io"
3325 "io/fs"
3426 "math/rand"
@@ -37,6 +29,15 @@ import (
3729 "path/filepath"
3830 "runtime"
3931 "strings"
32+
33+ "github.com/JetBrains/qodana-cli/v2025/platform"
34+ "github.com/JetBrains/qodana-cli/v2025/platform/msg"
35+ "github.com/JetBrains/qodana-cli/v2025/platform/product"
36+ "github.com/JetBrains/qodana-cli/v2025/platform/strutil"
37+ "github.com/JetBrains/qodana-cli/v2025/platform/utils"
38+ cp "github.com/otiai10/copy"
39+ "github.com/pterm/pterm"
40+ log "github.com/sirupsen/logrus"
4041)
4142
4243func downloadAndInstallIDE (
@@ -210,13 +211,14 @@ func getIde(analyzer product.Analyzer) *ReleaseDownloadInfo {
210211
211212// installIdeWindowsExe is used as a fallback, since it needs installation privileges and alters the registry
212213func installIdeWindowsExe (archivePath string , targetDir string ) error {
213- output , err := exec .Command (
214- archivePath ,
214+ stdout , stderr , _ , err := utils .RunCmdRedirectOutput (
215+ "" ,
216+ strutil .QuoteForWindows (archivePath ),
215217 "/S" ,
216218 fmt .Sprintf ("/D=%s" , strutil .QuoteForWindows (targetDir )),
217- ). CombinedOutput ()
219+ )
218220 if err != nil {
219- return fmt .Errorf ("%s: %s. Output : %s" , archivePath , err , string ( output ) )
221+ return fmt .Errorf ("%s: %s. Stdout : %s. Stderr: %s " , archivePath , err , stdout , stderr )
220222 }
221223 return nil
222224}
@@ -237,16 +239,16 @@ func installIdeFromZip(archivePath string, targetDir string) error {
237239 if err != nil {
238240 return fmt .Errorf ("couldn't create a temporary directory %w" , err )
239241 }
240-
241- output , err := exec . Command (
242+ stdout , stderr , _ , err := utils . RunCmdRedirectOutput (
243+ "" ,
242244 "tar" ,
243245 "-xf" ,
244- strutil .QuoteForWindows (archivePath ),
246+ strutil .GetQuotedPath (archivePath ),
245247 "-C" ,
246- strutil .QuoteForWindows (tempDir ),
247- ). CombinedOutput ()
248+ strutil .GetQuotedPath (tempDir ),
249+ )
248250 if err != nil {
249- return fmt .Errorf ("extracting files error: %w. Output : %s" , err , string ( output ) )
251+ return fmt .Errorf ("extracting files error: %w. Stdout : %s. Stderr: %s " , err , stdout , stderr )
250252 }
251253
252254 err = os .Rename (tempDir , targetDir )
@@ -276,17 +278,19 @@ func installIdeFromTar(archivePath string, targetDir string) error {
276278 if err := os .MkdirAll (targetDir , os .ModePerm ); err != nil {
277279 log .Fatal ("couldn't create a directory " , err .Error ())
278280 }
279- output , err := exec .Command (
281+ stdout , stderr , _ , err := utils .RunCmdRedirectOutput (
282+ "" ,
280283 "tar" ,
281284 "-xf" ,
282- archivePath ,
285+ strutil . GetQuotedPath ( archivePath ) ,
283286 "-C" ,
284- targetDir ,
287+ strutil . GetQuotedPath ( targetDir ) ,
285288 "--strip-components" ,
286289 "1" ,
287- ).CombinedOutput ()
290+ )
291+
288292 if err != nil {
289- return fmt .Errorf ("tar: %s. Output : %s" , err , string ( output ) )
293+ return fmt .Errorf ("tar: %s. Stdout : %s. Stderr: %s " , err , stdout , stderr )
290294 }
291295 return nil
292296}
@@ -380,7 +384,7 @@ func downloadCustomPlugins(ideUrl string, targetDir string, spinner *pterm.Spinn
380384 return fmt .Errorf ("error while downloading plugins: %v" , err )
381385 }
382386
383- _ , err = exec . Command ( " tar" , "-xf" , archivePath , "-C" , targetDir ). Output ( )
387+ _ , err = utils . RunCmd ( "" , " tar" , "-xf" , strutil . GetQuotedPath ( archivePath ) , "-C" , strutil . GetQuotedPath ( targetDir ) )
384388 if err != nil {
385389 return fmt .Errorf ("tar: %s" , err )
386390 }
0 commit comments