UNPKG

320 BJavaScriptView Raw
1"use strict";
2
3//wait for a process to end properly
4
5module.exports = function(child) {
6 return new Promise(function(accept, reject) {
7 child.once("error", reject);
8 child.once("close", function(result) {
9 if(result !== 0)
10 return reject("Invalid process exit code");
11 accept();
12 });
13 });
14};