mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-23 11:29:54 +00:00
* fix(cli): Windows process reads and Chrome cleanup no longer pass PowerShell command text * fix(cli): a forced Chrome close on Windows ends what Chrome started * test(cli): the forced-close test's child holds no pipe to the browser * test(cli): the forced-close test's child outlives a dead parent, as Chrome's do * test(cli): forced-close test waits for the kill; PowerShell starts only via processReadArgs * fix(cli): Windows cleanup ends only a process the CLI started, never a pid it was handed
21 lines
1.0 KiB
PowerShell
21 lines
1.0 KiB
PowerShell
# The CLI's reads of Windows' process table and a file's version (utils/windowsProcesses.ts), run with -File; nothing
|
|
# a call passes is run as code. identity <id>: its start as a FILETIME. parent <id>: its parent's id.
|
|
# table: `id parent start name` lines. version <path>: the file's product version.
|
|
param([ValidateSet('identity', 'parent', 'table', 'version')][string]$Read, [string]$Target = '')
|
|
$ErrorActionPreference = 'SilentlyContinue'
|
|
|
|
function Find-Process([string]$Id) {
|
|
if ($Id -match '^\d+$') { Get-CimInstance Win32_Process -Filter "ProcessId=$([int]$Id)" }
|
|
}
|
|
|
|
switch ($Read) {
|
|
'identity' { $process = Find-Process $Target; if ($process) { $process.CreationDate.ToFileTimeUtc() } }
|
|
'parent' { $process = Find-Process $Target; if ($process) { $process.ParentProcessId } }
|
|
'table' {
|
|
Get-CimInstance Win32_Process | ForEach-Object {
|
|
'{0} {1} {2} {3}' -f $_.ProcessId, $_.ParentProcessId, $_.CreationDate.ToFileTimeUtc(), $_.Name
|
|
}
|
|
}
|
|
'version' { if ($Target) { (Get-Item -LiteralPath $Target).VersionInfo.ProductVersion } }
|
|
}
|