Skip to content

Commit 6277201

Browse files
fix: Import-Module 7.6.0 and 7.6.1 throws error in disconnected environments (#481)
* fix: Import-Module 7.6.0 and 7.6.1 throws error in disconnected environments Fixes #466
1 parent 0cd0c46 commit 6277201

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## 7.9.0
44

5+
Merged [Pull Request](https://github.com/MethodsAndPractices/vsteam/pull/481) from [Sebastian Schütze](https://github.com/SebastianSchuetze) the following:
6+
- fixed a bug that prevented the module to load when the user has no access to the internet.[#466](https://github.com/MethodsAndPractices/vsteam/issues/466)
7+
58
Merged [Pull Request](https://github.com/MethodsAndPractices/vsteam/pull/480) from [Sebastian Schütze](https://github.com/SebastianSchuetze) the following:
69
- fixed a problem that prevented the module to load [#467](https://github.com/MethodsAndPractices/vsteam/issues/467)
710

Source/Private/common.ps1

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,8 +1150,16 @@ function _getBillingToken {
11501150
function _pinpGithub {
11511151
Write-Verbose "Checking if client is online"
11521152
$pingGh = [System.Net.NetworkInformation.Ping]::new()
1153-
[System.Net.NetworkInformation.PingReply]$reply = $pingGh.Send('github.com', 150)
1154-
return $reply.Status
1153+
$replyStatus = $null
1154+
try {
1155+
[System.Net.NetworkInformation.PingReply]$reply = $pingGh.Send('github.com', 150)
1156+
$replyStatus = $reply.Status
1157+
}
1158+
catch {
1159+
$replyStatus = [System.Net.NetworkInformation.IPStatus]::Unknown
1160+
Write-Debug $_.Exception.InnerException
1161+
}
1162+
return $replyStatus
11551163
}
11561164

11571165
function _showModuleLoadingMessages {
@@ -1208,7 +1216,7 @@ function _showModuleLoadingMessages {
12081216
}
12091217
}
12101218
else {
1211-
Write-Debug "Client is offline. Skipping module messages"
1219+
Write-Information "Client is offline or blocked by a firewall. Skipping module messages"
12121220
}
12131221
}
12141222
}
@@ -1247,7 +1255,7 @@ function _checkForModuleUpdates {
12471255
}
12481256
}
12491257
else {
1250-
Write-Debug "Client is offline. Skipping module updates check"
1258+
Write-Information "Client is offline or blocked by a firewall. Skipping module updates check"
12511259
}
12521260
}
12531261

0 commit comments

Comments
 (0)