title: Error: ENOENT: no such file or directory while using exec()
body: <p>I have a server like this:</p>
  
  <pre><code>const fs= require('fs');
  const express = require('express');
  const app = express();
  const hostname = '127.0.0.1'; // Local host ip.
  const homebase = fs.readFileSync('./with_radio_final.html');
  
  var exec = require('child_process').exec, child;
  express.static('.');
  var sub="";
  var obj="";
  var pred="";
  var type="";
  app.use(express.static('.'));
  
  
  app.get('/',(req, res) =&gt; {
     sub=req.query['Subject'];
     pred=req.query['Predicate'];
     obj=req.query['ObjecT'];
     type=req.query['type'];
  
     if(sub != undefined){
      console.log("SUBJECT= "+sub);
      console.log("PREDICATE= "+pred);
      console.log("OBJECT= "+obj);
      console.log("TYPE= "+type);
      }
    res.statusCode = 200;
    res.setHeader('Content-Type', 'text/html');
    res.write(homebase);
    res.end();
  });
  
  app.get('/q_out_list.html', (req, res) =&gt;{
    console.log("In q_out");
    if(sub!=undefined)
    {
      if(type==='Search')
              str = './search "&lt;'+sub+','+pred+','+obj+'&gt;" &gt; temp';
      if(type==='Create')
              str = './create "&lt;'+sub+','+pred+','+obj+'&gt;" &gt; temp';
      if(type==='Delete')
              str = './delete "&lt;'+sub+','+pred+','+obj+'&gt;" &gt; temp';
      //console.log(str);
      //The exec() creates a file q_out_list.html
       exec(str, function(error, stdout, stderr){
              console.log('stdout:'+stdout);
              console.log('stderr:'+stderr);
              if(error!=null){
                  console.log('exec error: '+error);
              }
          exec('bash create_q_out_list.sh',
              function(error, stdout, stderr){
                  console.log('stdout:'+stdout);
                  console.log('stderr:'+stderr);
                  if(error!=null){
                      console.log('exec error: '+error);
                }
          });
       });
    }
    const q_out = fs.readFileSync('./q_out_list.html');
    res.statusCode = 200;
    res.setHeader('Content-Type', 'text/html');
    res.write(q_out);
    res.end();
  });
  </code></pre>
  
  <p>When I click on a button on my web-page, q_out_list.html is requested. The second app.get() has exec() which creates the q_out_list.html file. I have checked that it does create this file in the current directory. But I am still getting this error.</p>