Skip to content

Commit 6f24884

Browse files
committed
fix: Use 'sh' instead of 'source'
This prevents any varaible clobbering or any cofounding effects
1 parent 0d71a79 commit 6f24884

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

pkg/lib/do.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,25 @@ do_set() {
2020
# -------------------------- set ------------------------- #
2121
# Source category pre
2222
if [ -f "$dbDir/$category/set-pre.sh" ]; then
23-
source "$dbDir/$category/set-pre.sh" "$dbDir/$category" "$program"
23+
sh "$dbDir/$category/set-pre.sh" "$dbDir/$category" "$program"
2424
fi
2525

2626
# Source program pre
2727
if [ -f "$dbDir/$category/$program/set-pre.sh" ]; then
28-
source "$dbDir/$category/$program/set-pre.sh" "$dbDir/$category" "$program"
28+
sh "$dbDir/$category/$program/set-pre.sh" "$dbDir/$category" "$program"
2929
fi
3030

3131
# Actually set
3232
printf "%s" "$program" >| "$dbDir/$category/_.current"
3333

3434
# Source program post
3535
if [ -f "$dbDir/$category/$program/set-post.sh" ]; then
36-
source "$dbDir/$category/$program/set-post.sh" "$dbDir/$category" "$program"
36+
sh "$dbDir/$category/$program/set-post.sh" "$dbDir/$category" "$program"
3737
fi
3838

3939
# Source category post
4040
if [ -f "$dbDir/$category/set-post.sh" ]; then
41-
source "$dbDir/$category/set-post.sh" "$dbDir/$category" "$program"
41+
sh "$dbDir/$category/set-post.sh" "$dbDir/$category" "$program"
4242
fi
4343

4444
log.info "Category '$category' defaults to '$program'"
@@ -69,18 +69,18 @@ do_launch() {
6969
# ------------------------ launch ------------------------ #
7070
# Source category pre
7171
if [ -f "$dbDir/$category/launch-pre.sh" ]; then
72-
source "$dbDir/$category/launch-pre.sh" "$dbDir/$category" "$program"
72+
sh "$dbDir/$category/launch-pre.sh" "$dbDir/$category" "$program"
7373
fi
7474

7575
# Source program pre
7676
if [ -f "$dbDir/$category/$program/launch-pre.sh" ]; then
77-
source "$dbDir/$category/$program/launch-pre.sh" "$dbDir/$category" "$program"
77+
sh "$dbDir/$category/$program/launch-pre.sh" "$dbDir/$category" "$program"
7878
fi
7979

8080
# Source launch if it exists. If otherwise, infer
8181
# the launch command from the program name
8282
if [ -f "$dbDir/$category/$program/launch.sh" ]; then
83-
if ! source "$dbDir/$category/$program/launch.sh" "$dbDir/$category" "$program"; then
83+
if ! sh "$dbDir/$category/$program/launch.sh" "$dbDir/$category" "$program"; then
8484
log.die "$gui" "Source failed"
8585
fi
8686
else
@@ -89,12 +89,12 @@ do_launch() {
8989

9090
# Source program post
9191
if [ -f "$dbDir/$category/$program/launch-post.sh" ]; then
92-
source "$dbDir/$category/$program/launch-post.sh" "$dbDir/$category" "$program"
92+
sh "$dbDir/$category/$program/launch-post.sh" "$dbDir/$category" "$program"
9393
fi
9494

9595
# Source category post
9696
if [ -f "$dbDir/$category/launch-post.sh" ]; then
97-
source "$dbDir/$category/launch-post.sh" "$dbDir/$category" "$program"
97+
sh "$dbDir/$category/launch-post.sh" "$dbDir/$category" "$program"
9898
fi
9999
}
100100

0 commit comments

Comments
 (0)