]> git.immae.eu Git - github/fretlink/purs-loader.git/blobdiff - src/Psc.js
Version 2.4.0-beta.0
[github/fretlink/purs-loader.git] / src / Psc.js
index 8fe843751442b42b2dae5de7ca4374d996b03661..ffa32b714a69c43bcf8954c8b8f9bb2e35d71c78 100644 (file)
@@ -33,8 +33,9 @@ function compile(psModule) {
 
     const compilation = spawn(options.psc, args)
 
-    compilation.stdout.on('data', data => stderr.push(data.toString()))
-    compilation.stderr.on('data', data => stderr.push(data.toString()))
+    compilation.stderr.on('data', data => {
+      stderr.push(data.toString());
+    });
 
     compilation.on('close', code => {
       debug('finished compiling PureScript.')
@@ -44,7 +45,12 @@ function compile(psModule) {
         if (errorMessage.length) {
           psModule.emitError(errorMessage);
         }
-        reject(new Error('compilation failed'))
+        if (options.watch) {
+          resolve(psModule);
+        }
+        else {
+          reject(new Error('compilation failed'))
+        }
       } else {
         const warningMessage = stderr.join('');
         if (options.warnings && warningMessage.length) {