Skip to content

Commit 7442c81

Browse files
committed
chore: debug
1 parent 1f7fd05 commit 7442c81

2 files changed

Lines changed: 13 additions & 16 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,18 @@ jobs:
129129
node-version: ${{ matrix.node-version }}
130130
cache: 'npm'
131131

132+
- uses: actions/download-artifact@v5
133+
with:
134+
name: build
135+
132136
- name: Fetch deps
133137
run: npm ci
134138

135-
- name: Build
136-
run: npm run build
137-
138139
- name: Run all tests
139140
if: matrix.os == 'ubuntu-24.04'
140141
run: npm run test
141142

142-
- name: Run win32 tests
143+
- name: Run legacy tests only
143144
if: matrix.os != 'ubuntu-24.04'
144145
timeout-minutes: 2
145146
run: npm run x:test:legacy

src/main/ts/ps.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,27 @@ const LOOKUPS: Record<string, {
2626
}
2727
},
2828
pwsh: {
29-
cmd: 'powershell',
30-
args: ['-NoProfile', '-Command', 'Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId,CommandLine | ConvertTo-Json -Compress'],
29+
cmd: 'pwsh',
30+
args: ['-NoProfile', '-Command', '"Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId,CommandLine | ConvertTo-Json -Compress"'],
3131
parse(stdout: string) {
3232
let arr: any[] = []
3333
try {
3434
arr = JSON.parse(stdout)
3535
} catch {
3636
return []
3737
}
38+
3839
// Reshape into Ingrid-like objects for normalizeOutput
3940
return arr.map(p => ({
40-
ProcessId: [p.ProcessId],
41-
ParentProcessId: [p.ParentProcessId],
41+
ProcessId: [p.ProcessId + ''],
42+
ParentProcessId: [p.ParentProcessId + ''],
4243
CommandLine: p.CommandLine ? [p.CommandLine] : [],
4344
}))
4445
},
4546
},
4647
}
4748

48-
const isBin = (f: string): boolean => {
49+
const isBin = (f: string): boolean => {
4950
if (f === '') return false
5051
if (!f.includes('/') && !f.includes('\\')) return true
5152
if (f.length > 3 && f[0] === '"')
@@ -309,15 +310,10 @@ export const kill = (pid: string | number, opts?: TPsNext | TPsKillOptions | TPs
309310
return promise
310311
}
311312

312-
export const parseGrid = (output: string) =>
313-
output
314-
? normalizeOutput(parse(output, { format: IS_WIN ? 'win' : 'unix' }))
315-
: []
316-
317313
export const normalizeOutput = (data: TIngridResponse): TPsLookupEntry[] =>
318314
data.reduce<TPsLookupEntry[]>((m, d) => {
319-
const pid = d.PID?.[0] || d.ProcessId?.[0]
320-
const ppid = d.PPID?.[0] || d.ParentProcessId?.[0]
315+
const pid = (d.PID || d.ProcessId)?.[0]
316+
const ppid = (d.PPID || d.ParentProcessId)?.[0]
321317
const _cmd = d.CMD || d.CommandLine || d.COMMAND || []
322318
const cmd = _cmd.length === 1 ? _cmd[0].split(/\s+/) : _cmd
323319

0 commit comments

Comments
 (0)