Nodejs nexpect:获取所有输出行
Nodejs nexpect: Get all output lines
我有一个简单的案例,我想使用 nexpect 列出文件夹中的所有文件,然后添加一些 expect() 功能。
nexpect.spawn("ls -la /etc")
.run(function (err, output, exit) {
res.send(output);
});
结果,我只得到一行:
lrwxr-xr-x@ 1 root wheel 11 Oct 2 21:42 /etc -> private/etc
我的期望是获取所有 /etc,因为输出定义为 "output {Array} Array of lines of output examined" (https://github.com/nodejitsu/nexpect)。
作为附带问题:nexpect 到今天是否值得推荐(因为它已经一年没有更新了)?
这是因为您在 Mac 上,而 /etc 是一个符号链接。尝试添加 /
:
nexpect.spawn("ls -la /etc/")
.run(function (err, output, exit) {
res.send(output);
});
我有一个简单的案例,我想使用 nexpect 列出文件夹中的所有文件,然后添加一些 expect() 功能。
nexpect.spawn("ls -la /etc")
.run(function (err, output, exit) {
res.send(output);
});
结果,我只得到一行:
lrwxr-xr-x@ 1 root wheel 11 Oct 2 21:42 /etc -> private/etc
我的期望是获取所有 /etc,因为输出定义为 "output {Array} Array of lines of output examined" (https://github.com/nodejitsu/nexpect)。
作为附带问题:nexpect 到今天是否值得推荐(因为它已经一年没有更新了)?
这是因为您在 Mac 上,而 /etc 是一个符号链接。尝试添加 /
:
nexpect.spawn("ls -la /etc/")
.run(function (err, output, exit) {
res.send(output);
});