title: Is it safe to use a QTemporaryFile with a QProcess?
body: <p>I have to read a script from the user and call a <code>QProcess</code> passing that script as a <em>file</em>.</p>
  
  <p>For example, the user insert this, say, Python script</p>
  
  <pre><code>import sys
  print(sys.copyright)
  </code></pre>
  
  <p>and I have to put that script in a file, and call the python interpreter using that file.</p>
  
  <p>I thought to use a <code>QTemporaryFile</code>, because that file will serve just when launching the process, and I have no need to keep it open.</p>
  
  <p>The question is: is it safe to open a QTemporaryFile, write something in it, pass that file to a process (which will continue indefinitely) and then destroy the temporary file? What if the process will need that file again? What if the process keep the file open?</p>
  
  <p>I reckon that, if kept open by the process, no problem will arise: probably the QTemporaryFile will unlink the path, but data will still be accessible in memory.</p>
  
  <p>But what if the process will try to open the file again?</p>
  
  <p>Here a snippet as example (wrote on the fly)</p>
  
  <pre><code>QString script = QInputDialog::getText(blah);
  QTemporaryFile tmp;
  if (tmp.open()) {
      tmp.write(script.toUtf8());
      QStringList params;
      params &lt;&lt; tmp.fileName();
      QProcess *proc = new QProcess("/usr/bin/python3");
      proc-&gt;start(params);
  }
  </code></pre>