File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 3838 hooks :
3939 - id : packer_fmt
4040 - id : packer_validate
41+ args : [--no-cd] # Optionally disable changing working directory
4142` ` `
4243
4344## Contributing ##
Original file line number Diff line number Diff line change @@ -7,11 +7,11 @@ set -o pipefail
77function packer_validate() {
88 local exit_code=0
99
10- packer init . > /dev/null
10+ packer init $1 > /dev/null
1111
1212 # Allow us to get output if the validation fails
1313 set +o errexit
14- validate_output=$( packer validate " ${ARGS[@]} " . 2>&1 )
14+ validate_output=$( packer validate " ${ARGS[@]} " $1 2>&1 )
1515 exit_code=$?
1616 set -o errexit
1717
@@ -42,8 +42,12 @@ pids=()
4242for path in " ${UNIQUE_PATHS[@]} " ; do
4343 # Check each path in parallel
4444 {
45- pushd " $path " > /dev/null
46- packer_validate
45+ if [[ $NO_CD -eq 1 ]]; then
46+ packer_validate $path
47+ else
48+ pushd " $path " > /dev/null
49+ packer_validate .
50+ fi
4751 } &
4852 pids+=(" $! " )
4953done
Original file line number Diff line number Diff line change @@ -9,14 +9,20 @@ set -o pipefail
99# Globals:
1010# ARGS
1111# FILES
12+ # NO_CD
1213# ######################################
1314function util::parse_cmdline() {
1415 # Global variable arrays
1516 ARGS=()
1617 FILES=()
18+ export NO_CD=0
1719
1820 while (( "$# ")) ; do
1921 case " $1 " in
22+ --no-cd)
23+ NO_CD=1
24+ shift
25+ ;;
2026 -* )
2127 if [ -f " $1 " ]; then
2228 FILES+=(" $1 " )
You can’t perform that action at this time.
0 commit comments