Project

General

Profile

« Previous | Next » 

Revision 13465

bugfix: lib/runscripts/util.run: run_args_cmd(): don't prepend main to args if no args, because for a non-runscript, all args will be passed to main(), leading `main` to be doubled

View differences:

util.run
48 48
{ echo_func; "$@"; } # by default, generate error that it doesn't exist
49 49

  
50 50
gateway() # overridable handler for *all* targets
51
{ echo_func; if is_callable "$1"; then "$@"; else fallback "$@"; fi; }
51
{
52
	echo_func
53
	test $# -gt 0 || set -- main # default target
54
	if is_callable "$1"; then "$@"; else fallback "$@"; fi
55
}
52 56

  
53 57
if test ! "$is_runscript"; then # non-runscript
54 58
gateway() { echo_func; main "$@"; } # pass all args to main()
......
59 63
	if is_dot_script; then set -- "${include_args[@]}"
60 64
	else              eval set -- "$(reverse "${BASH_ARGV[@]}")"
61 65
	fi
62
	test $# -ge 1 || set -- main
63 66
	echo_cmd "$top_script" "$@"
64 67
	indent; time gateway "$@"
65 68
}

Also available in: Unified diff