@@ -20,25 +20,33 @@ do_set() {
20
20
# -------------------------- set ------------------------- #
21
21
# Source category pre
22
22
if [ -f " $db_dir /$category /set-pre.sh" ]; then
23
- sh " $db_dir /$category /set-pre.sh" " $db_dir /$category " " $program "
23
+ if ! sh " $db_dir /$category /set-pre.sh" " $db_dir /$category " " $program " ; then
24
+ return 1
25
+ fi
24
26
fi
25
27
26
28
# Source program pre
27
29
if [ -f " $db_dir /$category /$program /set-pre.sh" ]; then
28
- sh " $db_dir /$category /$program /set-pre.sh" " $db_dir /$category " " $program "
30
+ if ! sh " $db_dir /$category /$program /set-pre.sh" " $db_dir /$category " " $program " ; then
31
+ return 1
32
+ fi
29
33
fi
30
34
31
35
# Actually set
32
36
printf " %s" " $program " > | " $db_dir /$category /_.current"
33
37
34
38
# Source program post
35
39
if [ -f " $db_dir /$category /$program /set-post.sh" ]; then
36
- sh " $db_dir /$category /$program /set-post.sh" " $db_dir /$category " " $program "
40
+ if ! sh " $db_dir /$category /$program /set-post.sh" " $db_dir /$category " " $program " ; then
41
+ return 1
42
+ fi
37
43
fi
38
44
39
45
# Source category post
40
46
if [ -f " $db_dir /$category /set-post.sh" ]; then
41
- sh " $db_dir /$category /set-post.sh" " $db_dir /$category " " $program "
47
+ if ! sh " $db_dir /$category /set-post.sh" " $db_dir /$category " " $program " ; then
48
+ return 1
49
+ fi
42
50
fi
43
51
44
52
log.info " Category '$category ' defaults to '$program '"
@@ -69,32 +77,40 @@ do_launch() {
69
77
# ------------------------ launch ------------------------ #
70
78
# Source category pre
71
79
if [ -f " $db_dir /$category /launch-pre.sh" ]; then
72
- sh " $db_dir /$category /launch-pre.sh" " $db_dir /$category " " $program "
80
+ if ! sh " $db_dir /$category /launch-pre.sh" " $db_dir /$category " " $program " ; then
81
+ return 1
82
+ fi
73
83
fi
74
84
75
85
# Source program pre
76
86
if [ -f " $db_dir /$category /$program /launch-pre.sh" ]; then
77
- sh " $db_dir /$category /$program /launch-pre.sh" " $db_dir /$category " " $program "
87
+ if ! sh " $db_dir /$category /$program /launch-pre.sh" " $db_dir /$category " " $program " ; then
88
+ return 1
89
+ fi
78
90
fi
79
91
80
92
# Source launch if it exists. If otherwise, infer
81
93
# the launch command from the program name
82
94
if [ -f " $db_dir /$category /$program /launch.sh" ]; then
83
95
if ! sh " $db_dir /$category /$program /launch.sh" " $db_dir /$category " " $program " ; then
84
- log.die " $gui " " Source failed"
96
+ log.die " $gui " " Source failed" # TODO: fix error message
85
97
fi
86
98
else
87
99
log.die " $gui " " launch.sh for program '$program ' does not exist"
88
100
fi
89
101
90
102
# Source program post
91
103
if [ -f " $db_dir /$category /$program /launch-post.sh" ]; then
92
- sh " $db_dir /$category /$program /launch-post.sh" " $db_dir /$category " " $program "
104
+ if ! sh " $db_dir /$category /$program /launch-post.sh" " $db_dir /$category " " $program " ; then
105
+ return 1
106
+ fi
93
107
fi
94
108
95
109
# Source category post
96
110
if [ -f " $db_dir /$category /launch-post.sh" ]; then
97
- sh " $db_dir /$category /launch-post.sh" " $db_dir /$category " " $program "
111
+ if ! sh " $db_dir /$category /launch-post.sh" " $db_dir /$category " " $program " ; then
112
+ return 1
113
+ fi
98
114
fi
99
115
}
100
116
0 commit comments