title: Node child_process await result
body: <p>I have a async function which makes a <code>face_detection</code> command line call. It's working fine otherwise, but I can't make it to wait for the response. Here is my function:</p>
  <pre><code>async uploadedFile(@UploadedFile() file) {
      let isThereFace: boolean;
      const foo: child.ChildProcess = child.exec(
        `face_detection ${file.path}`,
        (error: child.ExecException, stdout: string, stderr: string) =&gt; {
          console.log(stdout.length);
  
          if (stdout.length &gt; 0) {
            isThereFace = true;
          } else {
            isThereFace = false;
          }
          console.log(isThereFace);
  
          return isThereFace;
        },
      );
  
      console.log(file);
  
      const response = {
        filepath: file.path,
        filename: file.filename,
        isFaces: isThereFace,
      };
      console.log(response);
  
      return response;
    }
  </code></pre>
  <p><code>isThereFace</code> in my response I return is always <code>undefined</code> because the response is sent to client before the response from <code>face_detection</code> is ready. How could I make this work?</p>