use pgrep & kill $pid, not ps+gawk+regex+system+kill (#400)

* use pgrep & kill, not ps+gawk+regex+system+kill
* install shellcheck and enable lint on macos/brew.
* add shellcheck fixes and exception
* reorder CHANGELOG entries
This commit is contained in:
Josh Rabinowitz 2019-03-09 10:14:47 -05:00 committed by GitHub
parent 792226c624
commit a2a9bd32ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 10 deletions

View File

@ -24,7 +24,7 @@ if [[ "$GITSECRET_DIST" == "brew" ]]; then
if [[ -f "/usr/local/bin/gpg1" ]]; then
ln -s /usr/local/bin/gpg1 /usr/local/bin/gpg
fi
brew install gawk
brew install gawk shellcheck
fi
# Linux:

View File

@ -16,6 +16,7 @@ function run_kitchen_tests {
if [[ "$GITSECRET_DIST" == "brew" ]]; then
# Only running `make test` on standard (non-docker) build,
# since it is called inside the docker container anyway.
make lint
make test
fi

View File

@ -3,6 +3,11 @@ dist: xenial
matrix:
fast_finish: true
include:
- os: osx
env: GITSECRET_DIST="brew"
sudo: required
language: ruby
rvm: 2.6
- os: linux
env: KITCHEN_REGEXP="gnupg1-alpine-latest"
services: docker
@ -83,11 +88,6 @@ matrix:
sudo: required
language: ruby
rvm: 2.6
- os: osx
env: GITSECRET_DIST="brew"
sudo: required
language: ruby
rvm: 2.6
before_install:
- gem update --system

View File

@ -26,11 +26,13 @@
## Misc
- Use Shellcheck on tests/ files, changes for Shellcheck in tests/ (#368)
- Use Shellcheck on tests/ files (#368)
- Run Shellcheck on osx travis tests (#403)
- Document SECRETS_VERBOSE and improve env var docs (#396)
- Update CHANGELOG.md to mention fix for #281 in v0.2.5 (#311)
- Add text explaining git-secret Style Guide and Development Philosophy
- Upgrade bats-core to v1.1.0, import bats-core into vendor/bats-core (#377)
- Use pgrep and kill to stop test gpg-agent subprocess (#376)
## Version 0.2.5

View File

@ -66,9 +66,17 @@ function test_user_password {
function stop_gpg_agent {
local username
username=$(id -u -n)
ps -wx -U "$username" | gawk \
'/gpg-agent --homedir/ { if ( $0 !~ "awk" ) { system("kill "$1) } }' \
> /dev/null 2>&1
local pid
pid=$(pgrep -U "$username" -f "gpg-agent --homedir.*$TEST_GPG_HOMEDIR")
if [[ -n "$pid" ]]; then
# shellcheck disable=SC2001
#echo "$pid" | sed "s/^/# '$BATS_TEST_DESCRIPTION' killing pid(s): /" >&3
# we want $pid to be whitespace split below, so don't quote
# shellcheck disable=SC2086
kill $pid
fi
}