File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -283,6 +283,10 @@ function get_tw_config_value() {
283283 printf ' %s' " $value " | sed -e ' s/[[:space:]]*$//'
284284}
285285
286+ function compile_tw_config() {
287+ twcfg.include_exec " autoexec.cfg" > lib/tmp/compiled.cfg
288+ }
289+
286290function get_tw_config() {
287291 if [ " $# " != " 2" ]
288292 then
@@ -304,7 +308,7 @@ function get_tw_config() {
304308 fi
305309 mkdir -p lib/tmp
306310 twcfg_line=0
307- twcfg.include_exec " autoexec.cfg " > lib/tmp/compiled.cfg
311+ compile_tw_config
308312 found_key=" $( grep " ^$config_key " lib/tmp/compiled.cfg | tail -n1 | cut -d' ' -f2- | xargs) "
309313 if [ " $found_key " == " " ]
310314 then
Original file line number Diff line number Diff line change @@ -277,7 +277,16 @@ function check_warnings() {
277277 wrn " "
278278 fi
279279 fi
280- port=" $( wc -l < <( grep ' ^sv_port ' lib/tmp/compiled.cfg) ) "
280+ # make sure the grep does not fail to open the non existent file
281+ if [ ! -f lib/tmp/compiled.cfg ]
282+ then
283+ compile_tw_config
284+ fi
285+ if ! port=" $( wc -l < <( grep ' ^sv_port ' lib/tmp/compiled.cfg) ) "
286+ then
287+ wrn " WARNING: failed to count ports in compiled.cfg"
288+ wrn " file should be at $PWD /lib/tmp/compiled.cfg"
289+ fi
281290 if [ " $port " != " " ] && [ " $port " -gt " 1" ]
282291 then
283292 wrn " WARNING: found sv_port $port times in your config"
You can’t perform that action at this time.
0 commit comments