[英]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的所有內容,因為輸出被定義為“輸出{Array}檢查的輸出行數組”( https://github.com/nodejitsu/nexpect )。
附帶的問題:從今天起,推薦使用nexpect(因為一年沒有更新過)嗎?
這是因為您使用的是Mac,而/ etc是符號鏈接。 嘗試添加/
:
nexpect.spawn("ls -la /etc/") .run(function (err, output, exit) { res.send(output); });
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.