cipherdocs
cipherdocs copied to clipboard
Files edited in some editors don't always get updated in encrypted format
This is an issue with how powershell sometimes doesn't always honor the -Wait flag. for example, if the editor was already open before the user requests to open his/her encrypted file, it's seen to not respect that (e.g. with .txt files and Visual Studio Code)
Inside CipherDocs.ps1 at Line 68 we do something like
Start-Process $tempClearFilePath -Wait # <== problem-o !
to launch the file and wait before CipherDoc reviews file state for re-encryption.
Since this is flaky, we need a better mechanism for that. Maybe monitor the file for changes (file system monitor?) as long as it's got open handles? Or ... ?
Seems that visual studio code might actually be collapsing processes ...
All closed
PS C:\> tasklist /fi "imagename eq code.exe"
INFO: No tasks are running which match the specified criteria.
Directly open code.exe
PS C:\> tasklist /fi "imagename eq code.exe"
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
Code.exe 15948 RDP-Tcp#3 1 64,304 K
Code.exe 18636 RDP-Tcp#3 1 39,392 K
Code.exe 18868 RDP-Tcp#3 1 33,068 K
Code.exe 10968 RDP-Tcp#3 1 99,056 K
Code.exe 6076 RDP-Tcp#3 1 32,664 K
Code.exe 18700 RDP-Tcp#3 1 10,916 K
Double click the pgp file, it opens inside the existing code window. The just-launched process info is
Process info is
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
116 11 3588 8144 0.05 15064 1 Code
Continuing after 'Wait-Process'
but it indeed exits immediately i.e. PID 15064 doesn't exist even though the content is open in the editor window.