Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2 from tobiaskohlbau/feature/launchGPGAgent
Browse files Browse the repository at this point in the history
add autolaunch of gpgc-connect-agent on windows side
  • Loading branch information
BlackReloaded authored Feb 17, 2020
2 parents f7d5c89 + b85c5b5 commit 1eaa507
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"io"
"log"
"os"
"os/exec"
"reflect"
"sync"
"syscall"
Expand Down Expand Up @@ -56,6 +57,13 @@ func queryPageant(buf []byte) (result []byte, err error) {

hwnd := win.FindWindow(syscall.StringToUTF16Ptr("Pageant"), syscall.StringToUTF16Ptr("Pageant"))

// Launch gpg-connect-agent
if hwnd == 0 {
log.Println("launching gpg-connect-agent")
exec.Command("gpg-connect-agent", "/bye").Run()
}

hwnd = win.FindWindow(syscall.StringToUTF16Ptr("Pageant"), syscall.StringToUTF16Ptr("Pageant"))
if hwnd == 0 {
err = errors.New("Could not find Pageant window")
return
Expand Down

0 comments on commit 1eaa507

Please sign in to comment.