2016-11-08 4 views
0

nexpectを使用してフォルダ内のすべてのファイルを一覧表示し、後でexpect()機能を追加する場合があります。Nodejs nexpect:すべての出力行を取得する

nexpect.spawn("ls -la /etc") 
     .run(function (err, output, exit) { 
      res.send(output); 
     }); 

結果として、私はちょうど一行得る:出力が出力線の出力{アレイ}アレイ」として定義されているので、私の期待は、/などの全てを取得するであろう

[email protected] 1 root wheel 11 Oct 2 21:42 /etc -> private/etc 

を(https://github.com/nodejitsu/nexpect)。

nexpectは今日(1年後に更新されていないので)現在推奨されていますか?

答えて

1

あなたがMac上にあり、/ etcがシンボリックリンクであることが原因です。 /を追加してみてください:

nexpect.spawn("ls -la /etc/") .run(function (err, output, exit) { res.send(output); });

関連する問題