title: How to use async/await with Gulp 4?
body: <p>I'm trying to do something like this:</p>
  
  <pre><code>gulp.task("test", async () =&gt; {
      return gulp.src("**/*.scss")
          .pipe(print((filePath) =&gt; `File: ${filePath}`));
  });
  </code></pre>
  
  <p>(print is <a href="https://www.npmjs.com/package/gulp-print" rel="noreferrer">gulp-print</a>)</p>
  
  <p>But it gives the following:</p>
  
  <pre><code>[22:08:43] Starting 'test'...
  [22:08:43] Finished 'test' after 12 ms
  [22:08:43] File: src\app\styles\app.scss
  [22:08:43] File: src\app\styles\test.scss
  </code></pre>
  
  <p>i.e. It finishes before the messages are printed.</p>
  
  <p>I'm using Gulp 4 (alpha 2 I think) and TypeScript (1.8.0-dev.20151204).</p>
  
  <p>The generated (ES6) code looks like this:</p>
  
  <pre><code>gulp.task("test", () =&gt; __awaiter(this, void 0, Promise, function* () {
      return gulp.src("**/*.scss")
          .pipe(print((filePath) =&gt; `File: ${filePath}`));
  }));
  </code></pre>
  
  <p>Where <code>__awaiter</code> is:</p>
  
  <pre><code>var __awaiter = (this &amp;&amp; this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
      return new Promise(function (resolve, reject) {
          generator = generator.call(thisArg, _arguments);
          function cast(value) { return value instanceof Promise &amp;&amp; value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
          function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
          function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
          function step(verb, value) {
              var result = generator[verb](value);
              result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
          }
          step("next", void 0);
      });
  };
  </code></pre>
  
  <p>Is it possible to get this working? I want to use <code>await</code> within my task function, but I can't do this without marking the function as asynchronous.</p>
  
  <p>I'm probably missing something obvious.</p>