Skip to content

Commit dc80581

Browse files
committed
fix(scripts): preserve optional-repo semantic on wkhtmltopdf-openemr
Rabbit-flagged regression in this PR. The previous code at startFarm.sh:68 and restartFarm.sh:32 had a comment marking `wkhtmltopdf-openemr` as optional. The unguarded `cd ~/...` silently failed when the directory was absent, so the subsequent `git pull` failed too -- but the script kept going. That silent failure WAS the "skip if absent" semantic. Adding `|| exit 1` (the SC2164 fix) turned the documented-optional repo into a hard requirement: a fresh host without the wkhtmltopdf checkout would exit before starting any docker containers. The build-tests suite (openemr#147/openemr#148) only covers demo_build.sh, so this regression wouldn't surface in CI -- the docker/scripts/* orchestration scripts run on the production EC2 host and were explicitly out-of-scope when openemr#146 was planned. Rabbit's review was the only layer that caught this. Fix: wrap both sites with `if [ -d ~/wkhtmltopdf-openemr ]` guards. Keeps the cd-failure-is-fatal semantic (so a stale dir without git history still exits loudly), but skips the block entirely when the optional repo isn't there. Refs: openemr#146 (issue), openemr#150 (this PR) Assisted-by: Claude Code
1 parent 4611ac3 commit dc80581

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

docker/scripts/restartFarm.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,16 @@ cd ~/ || exit 1
3030
cp ~/translations_development_openemr/languageTranslations_utf8.sql ~/html/translations/
3131

3232
# update optional wkhtmltopdf-openemr
33-
cd ~/wkhtmltopdf-openemr || exit 1
34-
git fetch origin
35-
git pull origin master
36-
cd ~/ || exit 1
33+
# Comment marks this repo as optional. Pre-cd-guard code tolerated a
34+
# missing directory because the unguarded `cd` silently failed; preserve
35+
# that "skip if absent" semantic explicitly now that cd is hard-exit on
36+
# failure.
37+
if [ -d ~/wkhtmltopdf-openemr ]; then
38+
cd ~/wkhtmltopdf-openemr || exit 1
39+
git fetch origin
40+
git pull origin master
41+
cd ~/ || exit 1
42+
fi
3743

3844
# rebuild simple website and copy translations to website
3945
cp -r ~/demo_farm_openemr/docker/html/* ~/html/

docker/scripts/startFarm.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,16 @@ git pull origin master
6666
cd ~/ || exit 1
6767

6868
# update optional wkhtmltopdf-openemr
69-
cd ~/wkhtmltopdf-openemr || exit 1
70-
git fetch origin
71-
git pull origin master
72-
cd ~/ || exit 1
69+
# Comment + the install-instructions header above mark this repo as
70+
# optional. Pre-cd-guard code tolerated a missing directory because the
71+
# unguarded `cd` silently failed; preserve that "skip if absent"
72+
# semantic explicitly now that cd is hard-exit on failure.
73+
if [ -d ~/wkhtmltopdf-openemr ]; then
74+
cd ~/wkhtmltopdf-openemr || exit 1
75+
git fetch origin
76+
git pull origin master
77+
cd ~/ || exit 1
78+
fi
7379

7480
# rebuild simple website and copy translations to website
7581
cp -r ~/demo_farm_openemr/docker/html/* ~/html/

0 commit comments

Comments
 (0)