0
我有以下Node.js的文件:node.js的 「不確定」 神祕出現
//test.js:
var hash=require('./hash');
var sys=require('sys');
sys.puts(hash.hash("asdf","asdf"));
和
//hash.js:
var exec=require('child_process').exec;
var sys=require('sys');
exports.hash=function(data,hash_type){
exec('pwd',function callback(error,stdout,stderr){
sys.puts(stdout);
});
}
當我做node test.js
,我得到下面的輸出:
[email protected]:~/Desktop/simple-hash$ node test.js
undefined
/home/hynese/Desktop/nodejs-simple-hash
爲什麼我得到「undefined」?我真的卡在這裏...
任何幫助,非常感謝。
提前許多感謝,
Doh! *劉海桌子* *非常感謝... – Eamorr
@Eamorr,一種快樂:) – davin