Skip to content

Commit 0c24ab2

Browse files
authored
Merge pull request #34 from IBM/debug_windows_download_issues
Add debugging of the powershell script to diagnose installation issues
2 parents 08780e1 + 297198a commit 0c24ab2

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

dist/index.js

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@ function colorize(string, color) {
1515
async function installCLI() {
1616
core.startGroup('Installing IBM Cloud CLI')
1717
if (process.platform == 'win32') {
18-
await exec.exec(`powershell -command "iex (New-Object Net.WebClient).DownloadString('https://clis.cloud.ibm.com/install/powershell')"`)
18+
// Download the script to a local file
19+
await exec.exec(`powershell -command "(New-Object Net.WebClient).DownloadString('https://clis.cloud.ibm.com/install/powershell') | Out-File -FilePath ibmcloud_install.ps1"`)
20+
// Add @echo on as the first line
21+
await exec.exec(`powershell -command "'Set-PSDebug -Trace 2' + [Environment]::NewLine + (Get-Content -Path ibmcloud_install.ps1 -Raw) | Set-Content -Path ibmcloud_install.ps1"`)
22+
// Print out the script content for debugging
23+
core.info('Contents of the modified script:')
24+
await exec.exec(`powershell -command "Get-Content -Path ibmcloud_install.ps1 | ForEach-Object { Write-Output $_ }"`)
25+
// Execute the modified script
26+
await exec.exec(`powershell -File ibmcloud_install.ps1`)
1927
// Add to PATH for the current step
2028
process.env.PATH += ';C:\\Program Files\\IBM\\Cloud\\bin'
2129
// Add to GITHUB_PATH for future steps

0 commit comments

Comments
 (0)