Forum: help-enMonitor Forum | Start New Thread
|RE: gpg-agent preventing continuation of Powershell script [ Reply ]|
By: Bernhard Reiter on 2020-02-05 09:14
the default of gpg-agent is to start and keep running until stopped
(because it is technically a "daemon" processe).
My guess is that the powershell script continues because it somehow tracks
traces of the gpg-agent daemon process (either because it is a supprocess or it keeps some input output connections). Maybe using "start-job" or "start-process" from Powershell helps (I haven't tested it, this is just me guessing from the powershell documentation.)
A workaround could be to start gpg-agent in a different process earlier, so this one is
not the one starting it.
Another one could be to stop the gpg-agent explictely, e.g. by using `gpgcon --kill gpg-agent` or so.
(All solutions untested - just ideas.)
|gpg-agent preventing continuation of Powershell script [ Reply ]|
By: G A on 2020-02-04 13:52
I have an issue using gpg to encrypt files via a Powershell script.
The script contains the path to gpg in the following variable:
$processName = "C:\Program Files (x86)\GnuPG\bin\gpg.exe"
It contains the parameters passed to gpg in the following variable:
$processArgs = "--batch --debug-all -vv --log-file $gpgLogFile --homedir $gpgHomeDir --cipher-algo AES256 --pinentry-mode loopback --passphrase-file $gpgPassphraseFile --symmetric `"$filename`""
Then executes gpg using the command (start-process is used to catch failed encryptions):
$encryptionProcess = (start-process $processName $processArgs -Wait -NoNewWindow)
The script executes, during which gpg-agent is invoked by gpg, and creates an encrypted *.gpg file (tested by decrypting it elsewhere). The script does not progress beyond this point due to gpg-agent still running. If I end the gpg-agent process, the script continues.
Does anyone know if I am missing something here, in how I am executing gpg, that is not closing gpg-agent after completion?