lightman-agent 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lightman-agent",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "LIGHTMAN Agent - System-level daemon for museum display machines",
5
5
  "private": false,
6
6
  "type": "module",
@@ -68,11 +68,24 @@ foreach ($tn in @($AgentTask, $KioskTask, $GuardianTask)) {
68
68
  if ($t) { Stop-ScheduledTask -TaskName $tn -ErrorAction SilentlyContinue; Unregister-ScheduledTask -TaskName $tn -Confirm:$false -ErrorAction SilentlyContinue }
69
69
  }
70
70
 
71
- # Kill processes
72
- Write-Host "[0c] Killing node.exe and Chrome..." -ForegroundColor Yellow
73
- Get-Process -Name "node" -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
74
- Get-Process -Name "chrome" -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
75
- Start-Sleep -Seconds 2
71
+ # Kill processes
72
+ Write-Host "[0c] Killing node.exe and Chrome..." -ForegroundColor Yellow
73
+ # IMPORTANT:
74
+ # If install-windows.ps1 is launched from the npm CLI wrapper (node.exe),
75
+ # killing all node.exe would terminate the installer mid-run.
76
+ $parentPid = $null
77
+ try {
78
+ $parentPid = (Get-CimInstance Win32_Process -Filter "ProcessId=$PID" -ErrorAction SilentlyContinue).ParentProcessId
79
+ } catch { }
80
+ Get-Process -Name "node" -ErrorAction SilentlyContinue | ForEach-Object {
81
+ if ($parentPid -and $_.Id -eq $parentPid) {
82
+ Write-Host " Keeping installer parent node.exe (PID $($_.Id))" -ForegroundColor DarkGray
83
+ } else {
84
+ Stop-Process -Id $_.Id -Force -ErrorAction SilentlyContinue
85
+ }
86
+ }
87
+ Get-Process -Name "chrome" -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
88
+ Start-Sleep -Seconds 2
76
89
 
77
90
  # Remove old files (keep NSSM and logs)
78
91
  Write-Host "[0d] Removing old agent files..." -ForegroundColor Yellow