title: How can I exec the ping command in nodejs on lambda?
body: <p>This runs locally and returns the ping output:</p>
  
  <pre><code>var exec = require('child_process').exec;
  function execute(command, callback){
      exec(command, function(error, stdout, stderr){ callback(stdout); });
  }
  execute("ping -c 3 localhost", function(name){
    console.log(name);
  });
  </code></pre>
  
  <p>Running this in lambda it completes but I never see output:</p>
  
  <pre><code>exports.handler = (event, context, callback) =&gt; {
      var exec = require('child_process').exec;
      function execute(command, callback){
          exec(command, function(error, stdout, stderr){ callback(stdout); });
      }
      execute("ping -c 3 localhost", function(name){
        console.log(name);
      });
  };
  </code></pre>
  
  <p>How do I get it to show output?</p>