'use strict';
const addLineNumbers = require('add-line-numbers');
const spawnSync = require('child_process').spawnSync;
const fs = require('fs');
const path = '/tmp/te';

module.exports = function listAndRun() {
    var text = [];

    const listing = fs.readFileSync(path, 'utf8');

    if (listing.length > 0) {
        text.push(addLineNumbers(listing) + '\n');

        const child = spawnSync('node', [path], {timeout: 100, maxBuffer: 100});
        text.push(`stdout: ${child.output[1]}`);
        text.push(`stderr: ${child.output[2]}`);

    } else {
        text.push("Code listing is empty\n");
    }

    console.log(text.join(''));
};

@@ -209,59 +209,341 @@
 ) %7B%0A
+%0A
     
-var text = %5B%5D;%0A%0A    const listing = fs.
+let readFileAsync = function(filename, encoding) %7B%0A        return new Promise(function(resolve, reject) %7B%0A            fs.readFile(filename, encoding, (data, err) =%3E %7B%0A                if (err) %7B%0A                    reject(err);%0A                %7D%0A                resolve(data);%0A            %7D);%0A        %7D);%0A    %7D;%0A    %0A    
 readFile
 Sync
@@ -538,17 +538,18 @@
 readFile
-S
+As
 ync(path
@@ -557,19 +557,68 @@
  'utf8')
-;%0A%0A
+%0A    .then(listing =%3E %7B%0A        var text = %5B%5D;%0A%0A    
     if (
@@ -635,24 +635,28 @@
 ngth %3E 0) %7B%0A
+    
         text
@@ -694,17 +694,20 @@
  '%5Cn');%0A
-%0A
+    
         
@@ -779,32 +779,36 @@
  100%7D);%0A        
+  
+  
 text.push(%60stdou
@@ -832,32 +832,36 @@
 %5B1%5D%7D%60);%0A        
+    
 text.push(%60stder
@@ -885,17 +885,20 @@
 %5B2%5D%7D%60);%0A
-%0A
+    
     %7D el
@@ -902,16 +902,20 @@
  else %7B%0A
+    
         
@@ -952,16 +952,20 @@
 ty%5Cn%22);%0A
+    
     %7D%0A%0A 
@@ -963,24 +963,28 @@
      %7D%0A%0A    
+  
+  
 console.log(
@@ -999,11 +999,64 @@
 n(''));%0A
+    %7D)%0A    .catch(err =%3E %7B%0A        throw err;%0A    %7D)%0A
 %7D;%0A

Change file IO in listAndRun to be asynchronous