bare-runtime 1.22.1-0 → 1.22.2

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 (3) hide show
  1. package/bin/bare +5 -6
  2. package/lib/spawn.js +27 -1
  3. package/package.json +24 -14
package/bin/bare CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
- require('../lib/spawn')(__filename, { stdio: 'inherit' }).on(
3
- 'exit',
4
- (exitCode) => {
5
- process.exitCode = exitCode === null ? 1 : exitCode
6
- }
7
- )
2
+ require('../lib/spawn')(__filename, {
3
+ stdio: 'inherit',
4
+ suppressSignals: true,
5
+ forwardExitCode: true
6
+ })
package/lib/spawn.js CHANGED
@@ -1,4 +1,6 @@
1
1
  const fs = require('fs')
2
+ const os = require('os')
3
+ const process = require('process')
2
4
  const childProcess = require('child_process')
3
5
  const runtime = require('..')
4
6
 
@@ -13,6 +15,8 @@ module.exports = function spawn(referrer, opts) {
13
15
  if (!opts) opts = {}
14
16
 
15
17
  const {
18
+ suppressSignals = false,
19
+ forwardExitCode = false,
16
20
  args = typeof Bare !== 'undefined'
17
21
  ? Bare.argv.slice(2)
18
22
  : process.argv.slice(2)
@@ -26,5 +30,27 @@ module.exports = function spawn(referrer, opts) {
26
30
  fs.chmodSync(bin, 0o755)
27
31
  }
28
32
 
29
- return childProcess.spawn(bin, args, opts)
33
+ const job = childProcess.spawn(bin, args, opts)
34
+
35
+ if (suppressSignals) {
36
+ process.on('SIGINT', onsignal).on('SIGTERM', onsignal)
37
+
38
+ job.once('exit', () => {
39
+ process.off('SIGINT', onsignal).off('SIGTERM', onsignal)
40
+ })
41
+ }
42
+
43
+ if (forwardExitCode) {
44
+ job.once('exit', (code, signal) => {
45
+ if (signal) {
46
+ process.exitCode = 0x80 | os.constants.signals[signal]
47
+ } else {
48
+ process.exitCode = code
49
+ }
50
+ })
51
+ }
52
+
53
+ return job
30
54
  }
55
+
56
+ function onsignal() {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-runtime",
3
- "version": "1.22.1-0",
3
+ "version": "1.22.2",
4
4
  "description": "Prebuilt Bare binaries for macOS, iOS, Linux, Android, and Windows",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -24,6 +24,10 @@
24
24
  "bare": "bare-subprocess",
25
25
  "default": "child_process"
26
26
  },
27
+ "fs": {
28
+ "bare": "bare-fs",
29
+ "default": "fs"
30
+ },
27
31
  "os": {
28
32
  "bare": "bare-os",
29
33
  "default": "os"
@@ -31,6 +35,10 @@
31
35
  "path": {
32
36
  "bare": "bare-path",
33
37
  "default": "path"
38
+ },
39
+ "process": {
40
+ "bare": "bare-process",
41
+ "default": "process"
34
42
  }
35
43
  },
36
44
  "scripts": {
@@ -47,24 +55,26 @@
47
55
  },
48
56
  "homepage": "https://github.com/holepunchto/bare-runtime",
49
57
  "dependencies": {
58
+ "bare-fs": "^4.4.4",
50
59
  "bare-os": "^3.0.1",
51
60
  "bare-path": "^3.0.0",
61
+ "bare-process": "^4.2.1",
52
62
  "bare-subprocess": "^5.0.0"
53
63
  },
54
64
  "optionalDependencies": {
55
- "bare-runtime-android-arm": "1.22.0",
56
- "bare-runtime-android-arm64": "1.22.0",
57
- "bare-runtime-android-ia32": "1.22.0",
58
- "bare-runtime-android-x64": "1.22.0",
59
- "bare-runtime-darwin-arm64": "1.22.0",
60
- "bare-runtime-darwin-x64": "1.22.0",
61
- "bare-runtime-ios-arm64": "1.22.0",
62
- "bare-runtime-ios-arm64-simulator": "1.22.0",
63
- "bare-runtime-ios-x64-simulator": "1.22.0",
64
- "bare-runtime-linux-arm64": "1.22.0",
65
- "bare-runtime-linux-x64": "1.22.0",
66
- "bare-runtime-win32-arm64": "1.22.0",
67
- "bare-runtime-win32-x64": "1.22.0"
65
+ "bare-runtime-android-arm": "1.22.2",
66
+ "bare-runtime-android-arm64": "1.22.2",
67
+ "bare-runtime-android-ia32": "1.22.2",
68
+ "bare-runtime-android-x64": "1.22.2",
69
+ "bare-runtime-darwin-arm64": "1.22.2",
70
+ "bare-runtime-darwin-x64": "1.22.2",
71
+ "bare-runtime-ios-arm64": "1.22.2",
72
+ "bare-runtime-ios-arm64-simulator": "1.22.2",
73
+ "bare-runtime-ios-x64-simulator": "1.22.2",
74
+ "bare-runtime-linux-arm64": "1.22.2",
75
+ "bare-runtime-linux-x64": "1.22.2",
76
+ "bare-runtime-win32-arm64": "1.22.2",
77
+ "bare-runtime-win32-x64": "1.22.2"
68
78
  },
69
79
  "devDependencies": {
70
80
  "prettier": "^3.3.3",