saucectl 0.125.0 → 0.127.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 +22 -4
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -2,8 +2,9 @@
2
2
  const { spawn } = require('child_process');
3
3
  const path = require('path');
4
4
  const { BinWrapper } = require('@saucelabs/bin-wrapper');
5
+ const { Writable } = require('stream');
5
6
 
6
- const version = '0.125.0'
7
+ const version = '0.127.0'
7
8
  const defaultBinInstallBase = 'https://github.com/saucelabs/saucectl/releases/download';
8
9
  const binWrapper = (binInstallURL = null, binInstallBase = null) => {
9
10
  const bw = new BinWrapper();
@@ -46,16 +47,33 @@ const binWrapper = (binInstallURL = null, binInstallBase = null) => {
46
47
  return bw;
47
48
  }
48
49
 
50
+ async function preRun (b) {
51
+ let buf = Buffer.from('');
52
+ const st = new Writable();
53
+ st._write = (d) => buf = Buffer.concat([buf, d]);
54
+
55
+ const exitCode = await b.run(['--version'], {
56
+ stdout: st,
57
+ stderr: st,
58
+ });
59
+
60
+ if (exitCode !== 0) {
61
+ console.log('Post-installation checks failed. saucectl output was:')
62
+ console.log(buf.toString());
63
+ // eslint-disable-next-line no-process-exit
64
+ process.exit(exitCode);
65
+ }
66
+ }
67
+
49
68
  /* istanbul ignore next */
50
69
  async function main (b, args) {
51
- await b.run(['--version']);
70
+ await preRun(b);
52
71
  const saucectlProcess = spawn(b.path(), args, {
53
72
  stdio: [process.stdin, process.stdout, process.stderr]
54
73
  });
55
74
  saucectlProcess.on('exit', function (code) {
56
- /* eslint-disable */
75
+ // eslint-disable-next-line no-process-exit
57
76
  process.exit(code);
58
- /* eslint-enable */
59
77
  });
60
78
  }
61
79
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saucectl",
3
- "version": "0.125.0",
3
+ "version": "0.127.0",
4
4
  "description": "Node.js wrapper for saucectl",
5
5
  "main": "index.js",
6
6
  "bin": "index.js",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "homepage": "https://github.com/saucelabs/node-saucectl#readme",
38
38
  "dependencies": {
39
- "@saucelabs/bin-wrapper": "~0.2.0"
39
+ "@saucelabs/bin-wrapper": "^0.4.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "eslint": "^6.8.0",