From 10c22a6c8806a23695c4434c659dce5cd822b0de Mon Sep 17 00:00:00 2001 From: igor04091968 Date: Tue, 5 May 2026 00:55:04 +0300 Subject: [PATCH] fix(windows): add STA parameter for DLP collector and use TEMP for lock files - Add -STA parameter when launching endpoint-signals collector for clipboard access - Move launch-watchers lock files from ProgramData to TEMP to avoid permission issues - This fixes DLP endpoint collector startup in RDP sessions Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- windows/ActivityWatch.Windows.Common.psm1 | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/windows/ActivityWatch.Windows.Common.psm1 b/windows/ActivityWatch.Windows.Common.psm1 index 6c869f7..71e573f 100755 --- a/windows/ActivityWatch.Windows.Common.psm1 +++ b/windows/ActivityWatch.Windows.Common.psm1 @@ -525,11 +525,7 @@ function Get-CollectorPowerShellProcessCount { function New-LaunchLock { param([string]`$StateRoot, [int]`$SessionId) - if (-not (Test-Path -LiteralPath `$StateRoot)) { - New-Item -Path `$StateRoot -ItemType Directory -Force | Out-Null - } - - `$lockPath = Join-Path `$StateRoot ("launch-watchers-session-{0}.lock" -f `$SessionId) + `$lockPath = Join-Path `$env:TEMP ("launch-watchers-session-{0}.lock" -f `$SessionId) if (Test-Path -LiteralPath `$lockPath) { try { `$lockData = Get-Content -LiteralPath `$lockPath -Raw | ConvertFrom-Json @@ -722,13 +718,11 @@ function Start-CollectorScriptIfNeeded { return } - Start-Process -FilePath `$PowerShellExe -ArgumentList @( - '-NoProfile', - '-WindowStyle', 'Hidden', - '-ExecutionPolicy', 'Bypass', - '-File', `$ScriptPath, - '-ConfigPath', `$ConfigPath - ) -WindowStyle Hidden + $staParam = if (`$ScriptPath -like "*endpoint-signals*") { "-STA" } else { $null } + $argumentList = @('-NoProfile', '-WindowStyle', 'Hidden', '-ExecutionPolicy', 'Bypass') + if ($staParam) { $argumentList += $staParam } + $argumentList += @('-File', `$ScriptPath, '-ConfigPath', `$ConfigPath) + Start-Process -FilePath `$PowerShellExe -ArgumentList $argumentList -WindowStyle Hidden } `$config = Get-DeploymentConfig -Path `$ConfigPath