title: When using temp.mkdir in node.js, the output file made by an exe that was called cannot be found in the temporary directory
body: <p>I've tried running the EXE without using temp.mkdir and it works fine with the input and output files appear in the main directory. However, I want to be able to use a temporary directory since I want node to create the input file, run the program with the created input file, and read the output file, and then delete the temporary directory to prevent the input and output files being saved every time the program is ran.</p>
  <pre><code>app.post('/Test', (req, res) =&gt; {
      const exec = require('child_process').exec;
      const execFile = require('child_process').execFile;
      const program = &quot;.\\cpp\\a.exe&quot;;
      const input = req.body.input;
  
      temp.mkdir('test', (err, dirPath) =&gt; {
          const inputPath = path.join(dirPath, 'input.txt');
          const outputPath = path.join(dirPath, 'output.txt');
          fs.writeFile(inputPath, input, (err) =&gt; {
              if (err) throw err;
              const child = execFile(program, (error) =&gt; {
                  if (error) throw error;
                  fs.readFile(outputPath, function(err, data) {
                      if (err) throw err;
                      const output = data;
                      res.render(&quot;test&quot;, {
                          progOut: output
                      });
                      exec('del -r ' + dirPath, (error) =&gt; {
                          if (error) throw error;
                          console.log(&quot;Removed &quot; + dirPath);
                      })
                  });
              });
          });
      });
  });
  </code></pre>
  <p>Code is probably very rudimentary, and inefficient but that's just me trying to debug certain parts.</p>