Erlang shell - no input for commands

169 views Asked by At

My os: arch linux. I recently installed erlang (Erlang (BEAM) emulator version 9.0.1).

When I type "erl" command I expect the erlang shell to start invoking the commands I type (for the simplest example: 2+3. should return 5)

However, after I run "erl" nothing shows up on screen. I can type anything I want, nothing is executed. Images with example are attached.

What I expect.jpg

What I got.jpg

Now I only started to learn erlang, and this is confusing. Don't know if it is some repository bug, or erlang normal behavior?

UPD: I got some custom configuration in .bashrc file:

# setup color variables
color_is_on=
color_red=
color_green=
color_yellow=
color_blue=
color_white=
color_gray=
color_bg_red=
color_off=
color_user=
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
    color_is_on=true
    color_black="\[$(/usr/bin/tput setaf 0)\]"
    color_red="\[$(/usr/bin/tput setaf 1)\]"
    color_green="\[$(/usr/bin/tput setaf 2)\]"
    color_yellow="\[$(/usr/bin/tput setaf 3)\]"
    color_blue="\[$(/usr/bin/tput setaf 6)\]"
    color_white="\[$(/usr/bin/tput setaf 7)\]"
    color_gray="\[$(/usr/bin/tput setaf 8)\]"
    color_off="\[$(/usr/bin/tput sgr0)\]"

    color_error="$(/usr/bin/tput setab 1)$(/usr/bin/tput setaf 7)"
    color_error_off="$(/usr/bin/tput sgr0)"

    # set user color
    case `id -u` in
        0) color_user=$color_red ;;
        *) color_user=$color_green ;;
    esac
fi



function prompt_command {
    # get cursor position and add new line if we're not in first column
    exec < /dev/tty
    local OLDSTTY=$(stty -g)
    stty raw -echo min 0
    echo -en "\033[6n" > /dev/tty && read -sdR CURPOS
    stty $OLDSTTY
    [[ ${CURPOS##*;} -gt 1 ]] && echo "${color_error}↵${color_error_off}"


    # build b/w prompt for git and vertial env
    [[ ! -z $GIT_BRANCH ]] && PS1_GIT=" (git: ${GIT_BRANCH})"
    [[ ! -z $VIRTUAL_ENV ]] && PS1_VENV=" (venv: ${VIRTUAL_ENV#$WORKON_HOME})"

    # calculate fillsize
    local fillsize=$(($COLUMNS-$(printf "${USER}@${HOSTNAME}:${PWD}:${PWDNAME}${PS1_GIT}${PS1_VENV} " | wc -c | tr -d " ")))

    local FILL=$color_white
    while [ $fillsize -gt 0 ]; do FILL="${FILL}─"; fillsize=$(($fillsize-1)); done
    FILL="${FILL}${color_off}"



    # set new color prompt
    PS1="${color_user}${USER}${color_off}@${color_yellow}${HOSTNAME}${color_off}:${color_white}${PWD}:${PWDNAME}${color_off}${PS1_GIT}${PS1_VENV} ${FILL}\n➜ "
}


PROMPT_COMMAND=prompt_command

After removing this configuration, erl started to work normally.

0

There are 0 answers