我开始学习node.js。我先读了书籍《The Node Beginner》,那里给出的代码似乎是为在Unix环境下运行而编写的,我不知道如何为Windows编写相应的代码,以下是给出的代码部分。
var exec=require("child_process").exec;
function start(){
console.log("Request handler 'start' was called");
var content="empty";
exec("ls -lah", function(error, stdout, stderr){
content= stdout;
});
return content;
/*
function sleep(milliSeconds){
var startTime=new Date().getTime();
while(new Date().getTime()< startTime+milliSeconds);
}
sleep(10000);
return "Hello Start"; */
}
如果你曾经读过这本书或者对如何使这段代码工作有任何想法,我会非常感激。
dir /w
吗? - Joe