title: response.write within callback function
body: <p>I am new to NodeJS and following this book(<a href="http://www.nodebeginner.org/" rel="nofollow">http://www.nodebeginner.org/</a>). </p>
  
  <p>This code is from that book and this function did not list the files inside the current directory which was supposed to happen. </p>
  
  <pre><code>var exec = require("child_process").exec;
  
  function start(response){
      console.log("Request handler 'start' was called.");
  
      exec("ls -lah",function(error,stdout,stderr){
          response.writeHead(200,{"Content-Type":"text/plain"});
          response.write(stdout);
          response.end();
     });
  
  }
  </code></pre>
  
  <p>Then I changed the code to print the return value of response.write function as follows. And when I run it printed "true" on command line. That is return value is "true".</p>
  
  <pre><code>function start(response){
      console.log("Request handler 'start' was called.");
  
      exec("ls -lah",function(error,stdout,stderr){
          response.writeHead(200,{"Content-Type":"text/plain"});
          console.log(response.write(stdout));
          response.end();
     });
  
  }
  </code></pre>
  
  <p>Can anyone explain the reason?</p>
  
  <p>Thank you.</p>