diff --git a/lib/server-code/runners/cloud.js b/lib/server-code/runners/cloud.js
index <HASH>..<HASH> 100644
--- a/lib/server-code/runners/cloud.js
+++ b/lib/server-code/runners/cloud.js
@@ -11,7 +11,7 @@ function flushPendingLogs() {
 }
 
 function finalize() {
-  flushPendingLogs();
+  return flushPendingLogs();
 }
 
 exports.start = function(opts) {
@@ -34,5 +34,7 @@ exports.start = function(opts) {
       });
   }
 
-  return getTask().then(processTask).then(finalize);
+  return getTask()
+    .then(processTask)
+    .then(finalize);
 };
\ No newline at end of file
fix (cloud) flush client's log messages before exit in cloud mode