cafe-utility 1.43.0 → 1.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +16 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -901,6 +901,20 @@ const execAsync = async (command, resolveWithErrors, inherit, options) =>
901
901
  }
902
902
  })
903
903
 
904
+ const runProcess = async (command, args, onStdout, onStderr) =>
905
+ new Promise((resolve, reject) => {
906
+ const subprocess = ChildProcess.spawn(command, args)
907
+ subprocess.stdout.on('data', onStdout)
908
+ subprocess.stderr.on('data', onStderr)
909
+ subprocess.on('close', code => {
910
+ if (code === 0) {
911
+ resolve(code)
912
+ } else {
913
+ reject(code)
914
+ }
915
+ })
916
+ })
917
+
904
918
  const cloneWithJson = a => JSON.parse(JSON.stringify(a))
905
919
 
906
920
  const unixTimestamp = optionalTimestamp => Math.ceil((optionalTimestamp || Date.now()) / 1000)
@@ -1451,7 +1465,8 @@ module.exports = {
1451
1465
  waitFor,
1452
1466
  execAsync,
1453
1467
  getHeapMegabytes,
1454
- expandError
1468
+ expandError,
1469
+ runProcess
1455
1470
  },
1456
1471
  Numbers: {
1457
1472
  sum,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cafe-utility",
3
- "version": "1.43.0",
3
+ "version": "1.44.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "exports": {