Skip to content

Commit 12a6d75

Browse files
committed
Implement coderabbit suggestions
1 parent 55cbcbb commit 12a6d75

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎ci/tools/configure_driver_mode.ps1‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,16 @@ function Set-DriverMode {
7070

7171
Write-Output "Setting driver mode to $driver_mode..."
7272
nvidia-smi -fdm $driver_mode_code
73+
if ($LASTEXITCODE -ne 0) {
74+
throw "nvidia-smi -fdm $driver_mode_code ($driver_mode) failed with exit code $LASTEXITCODE"
75+
}
7376

7477
# Only restart NVIDIA display adapters, not other display devices (e.g. QEMU VGA).
7578
$nvidia_devices = @(Get-PnpDevice -Class Display -FriendlyName "NVIDIA*")
7679
$gpu_count = $nvidia_devices.Count
80+
if ($gpu_count -eq 0) {
81+
throw "No NVIDIA display devices were found."
82+
}
7783
foreach ($device in $nvidia_devices) {
7884
Write-Output "Restarting device: $($device.FriendlyName) ($($device.InstanceId))"
7985
pnputil /disable-device "$($device.InstanceId)"

0 commit comments

Comments
 (0)