Skip to content

Commit

Permalink
Merge pull request #531 from lrascao/fix/console_clean
Browse files Browse the repository at this point in the history
Give code path access to console_clean
  • Loading branch information
lrascao authored Oct 27, 2016
2 parents 3ecc5c8 + 602f866 commit cfd99cf
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion priv/templates/extended_bin
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ relx_start_command() {
"$START_OPTION"
}

relx_get_code_paths() {
code="{ok, [{release,_,_,Apps}]} = file:consult(\"$REL_DIR/$REL_NAME.rel\"),"\
"lists:foreach(fun(A) ->"\
" io:fwrite(\"$ROOTDIR/lib/~p-~s/ebin \", [element(1, A), element(2, A)]) "\
"end, Apps),"\
"halt()."

"$BINDIR/erl" -noshell -boot start_clean -eval "$code"
}

# Use $CWD/vm.args if exists, otherwise releases/VSN/vm.args
if [ -z "$VMARGS_PATH" ]; then
if [ -f "$RELEASE_ROOT_DIR/vm.args" ]; then
Expand Down Expand Up @@ -346,6 +356,7 @@ case "$1" in
;;

console|console_clean|console_boot)
__code_paths=""
# .boot file typically just $REL_NAME (ie, the app name)
# however, for debugging, sometimes start_clean.boot is useful.
# For e.g. 'setup', one may even want to name another boot script.
Expand All @@ -358,6 +369,7 @@ case "$1" in
fi
;;
console_clean)
__code_paths=$(relx_get_code_paths)
BOOTFILE="$ROOTDIR/bin/start_clean"
;;
console_boot)
Expand All @@ -381,7 +393,8 @@ case "$1" in
set -- "$BINDIR/erlexec" -boot "$BOOTFILE" -mode "$CODE_LOADING_MODE" \
-boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
-config "$RELX_CONFIG_PATH" \
-args_file "$VMARGS_PATH"
-args_file "$VMARGS_PATH" \
-pa ${__code_paths}

# Dump environment info for logging purposes
echo "Exec: $@" -- ${1+$ARGS}
Expand Down

0 comments on commit cfd99cf

Please sign in to comment.