Skip to content

Commit 7004d27

Browse files
committed
fix: critical windows deprecated wmic in 2025 causing get windows drives api to fail in github actions
1 parent d9bdec2 commit 7004d27

4 files changed

Lines changed: 14 additions & 10 deletions

File tree

dist/phoenix-fs.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,18 @@ function generateRandomId(length = 20) {
3131
}
3232

3333
function getWindowsDrives(callback) {
34-
exec('wmic logicaldisk get name', (error, stdout) => {
34+
// Use PowerShell instead of deprecated WMIC (not available in Windows Server 2025+)
35+
exec('powershell -Command "Get-CimInstance -ClassName Win32_LogicalDisk | Select-Object -ExpandProperty DeviceID"', (error, stdout) => {
3536
if (error) {
3637
callback(error, null);
3738
return;
3839
}
3940

40-
// Parse the result
41+
// Parse the result - each line is a drive like "C:" or "D:"
4142
const drives = stdout.split('\n')
42-
.filter(value => /^[A-Z]:/.test(value.trim()))
43-
.map(value => value.trim()[0]);
43+
.map(line => line.trim())
44+
.filter(line => /^[A-Z]:$/.test(line))
45+
.map(line => line[0]);
4446

4547
callback(null, drives);
4648
});

dist/virtualfs-debug.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.

dist/virtualfs.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-tauri/node-src/phoenix-fs.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,18 @@ function generateRandomId(length = 20) {
3131
}
3232

3333
function getWindowsDrives(callback) {
34-
exec('wmic logicaldisk get name', (error, stdout) => {
34+
// Use PowerShell instead of deprecated WMIC (not available in Windows Server 2025+)
35+
exec('powershell -Command "Get-CimInstance -ClassName Win32_LogicalDisk | Select-Object -ExpandProperty DeviceID"', (error, stdout) => {
3536
if (error) {
3637
callback(error, null);
3738
return;
3839
}
3940

40-
// Parse the result
41+
// Parse the result - each line is a drive like "C:" or "D:"
4142
const drives = stdout.split('\n')
42-
.filter(value => /^[A-Z]:/.test(value.trim()))
43-
.map(value => value.trim()[0]);
43+
.map(line => line.trim())
44+
.filter(line => /^[A-Z]:$/.test(line))
45+
.map(line => line[0]);
4446

4547
callback(null, drives);
4648
});

0 commit comments

Comments
 (0)