Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swoole-cli -a 运行时出现 Interactive shell (-a) requires the readline extension 解决办法 #182

Open
jingjingxyk opened this issue Oct 6, 2024 · 0 comments

Comments

@jingjingxyk
Copy link
Owner

jingjingxyk commented Oct 6, 2024

  1. 参照办法 fix readline not work恢复

  2. 通用shell 脚本解决

FOUND_DL_READLINE=$(grep -c '#ifdef COMPILE_DL_READLINE' ext/readline/readline_cli.c)

if test $[FOUND_DL_READLINE] -gt 0 ; then
    # 获得待删除 区间
    START_LINE_NUM=$(sed  -n "/#ifdef COMPILE_DL_READLINE/=" ext/readline/readline_cli.c)
    START_LINE_NUM=$(($START_LINE_NUM - 1))
    END_LINE_NUM=$(sed  -n "/PHP_MINIT_FUNCTION(cli_readline)/=" ext/readline/readline_cli.c)
    END_LINE_NUM=$(($END_LINE_NUM - 5))

    sed -i.backup "${START_LINE_NUM},${END_LINE_NUM}d" ext/readline/readline_cli.c

    REPLACE_LINE_NUM=$(sed  -n "/#define GET_SHELL_CB(cb) (cb) = php_cli_get_shell_callbacks()/=" ext/readline/readline_cli.c)
    REPLACE_LINE_NUM=$(($REPLACE_LINE_NUM + 1))

    sed -i.backup "${REPLACE_LINE_NUM} s/.*/  /" ext/readline/readline_cli.c

fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant