我想要一个获取Perl输出的进度指示器
system('make')
Run Code Online (Sandbox Code Playgroud)
并且对于从make命令输出到STDOUT的每一行,我想输出一个点作为进度指示器.不幸的是,我正在使用Term :: ReadLine :: Gnu Perl mod.
在make命令运行时,如何重定向STDOUT以捕获和计算行?
更新:我可能在尝试在其他地方找到解决方案时弄乱了我的系统.我从零开始,安装Ruby 1.9.3顺利安装.现在试着让ree-1.8.7和...一起玩得很好......
我正在尝试使用RVM在Kubuntu上安装Ruby 1.9.3(我相信11.10).到目前为止,我一直有很多关于Readline的问题,但除此之外我找到了答案.
我用这种方式安装了Ruby 1.9.3:
rvm install 1.9.3
# Install of ruby-1.9.3-p0 - #complete
cd ~/.rvm/src/ruby-1.9.3-p0/ext/readline/
~/.rvm/src/ruby-1.9.3-p0/ext/readline $ ../../ruby extconf.rb --with-editline-dir="/usr" --with-readline-dir="/usr"
# any other way of doing this resulted in simply readline not being loaded when trying to start the console
# I have libreadline6 and libreadline6-dev installed (and all the packages requested in `rvm requirements`
make install
# compiling readline.c
# linking shared-object readline.so
# /usr/bin/install -c -m 0755 readline.so /home/mbillard/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/x86_64-linux
# installing default readline libraries
Run Code Online (Sandbox Code Playgroud)
到目前为止,一切看起来都运行正常,但当我尝试启动控制台时,我收到此错误: …
我正在编写一个Go程序,它使用GNU readline库来创建一个花哨的命令行界面.为了简化安装过程而不用担心库版本和其他东西,我想静态链接它.
问题是我真的不知道该怎么做.如果我预编译库,我将不得不提供我的代码的几个版本,以及.a或.lib readline库的不同版本.为了避免这个问题,我考虑将当前的readline代码包含到我的go项目中,并让go工具在构建go项目时编译它.但是,要构建readline库,必须使用make.有没有办法告诉go工具如何构建C代码?
使用GNU Readline:
该函数readline()显示提示并读取用户的输入.
我可以修改其内部缓冲区吗?以及如何实现这一目标?
#include <readline/readline.h>
#include <readline/history.h>
int main()
{
char* input;
// Display prompt and read input
input = readline("please enter your name: ");
// Check for EOF.
if (!input)
break;
// Add input to history.
add_history(input);
// Do stuff...
// Free input.
free(input);
}
}
Run Code Online (Sandbox Code Playgroud) 我是GNU Readline的新手,所以我想知道是否存在可以取消readline()请求的功能?