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

Commit

Permalink
Better gpg-agent version parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
rupor-github committed Nov 12, 2021
1 parent 0e125b8 commit cce45e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ endif()
# Project version number
set(PRJ_VERSION_Major "1")
set(PRJ_VERSION_Minor "4")
set(PRJ_VERSION_Patch "1")
set(PRJ_VERSION_Patch "2")

if (EXISTS "${PROJECT_SOURCE_DIR}/.git" AND IS_DIRECTORY "${PROJECT_SOURCE_DIR}/.git")
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/cmake/githash.sh ${GIT_EXECUTABLE}
Expand Down
11 changes: 8 additions & 3 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,14 @@ func NewAgent(cfg *config.Config) (*Agent, error) {
if err != nil {
return nil, fmt.Errorf("unable to run \"%s\": %w", fname, err)
}
words := strings.Split(strings.Split(string(out), "\n")[0], " ")
if len(words) == 3 {
a.Ver = words[2]
lines := strings.Split(string(out), "\n")
if len(lines) > 0 {
words := strings.Split(lines[0], " ")
if len(words) >= 3 {
a.Ver = words[2]
} else {
a.Ver = lines[0]
}
}
a.Exe = fname

Expand Down

0 comments on commit cce45e6

Please sign in to comment.