fix: replace deprecated wmic with powershell for printer listing
This commit is contained in:
parent
e13355ce37
commit
853aeddb75
|
|
@ -11,12 +11,12 @@ export class ListPrinterService {
|
|||
async listPrinters(): Promise<string[]> {
|
||||
try {
|
||||
const { stdout } = await execAsync(
|
||||
'wmic printer get name',
|
||||
'powershell -Command "Get-Printer | Select-Object -ExpandProperty Name"',
|
||||
{ encoding: 'utf-8' }
|
||||
);
|
||||
|
||||
const printers = stdout
|
||||
.split('\n')
|
||||
.split('\r\n')
|
||||
.map(line => line.trim())
|
||||
.filter(line => line && line !== 'Name');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue