monosmith 2.0.0-beta.15 → 2.0.0-beta.16

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/bin/smith.js +17 -9
  2. package/package.json +7 -7
package/bin/smith.js CHANGED
@@ -2,7 +2,7 @@
2
2
  'use strict'
3
3
  // Runs the smith binary npm installed for this platform, from one of the
4
4
  // optional dependencies; nothing is downloaded after install.
5
- const { spawnSync } = require('node:child_process')
5
+ const { spawn } = require('node:child_process')
6
6
  const fs = require('node:fs')
7
7
 
8
8
  const platforms = {
@@ -34,12 +34,20 @@ if (process.platform !== 'win32') {
34
34
  try { fs.chmodSync(binary, 0o755) } catch { /* a read-only install keeps its mode */ }
35
35
  }
36
36
  }
37
- const result = spawnSync(binary, process.argv.slice(2), { stdio: 'inherit' })
38
- if (result.error) {
39
- console.error('smith: ' + result.error.message)
40
- process.exit(1)
41
- }
42
- if (result.signal) {
43
- process.kill(process.pid, result.signal)
37
+ // A stop request must reach the binary: forward it, never orphan the child.
38
+ const child = spawn(binary, process.argv.slice(2), { stdio: 'inherit' })
39
+ for (const sig of ['SIGINT', 'SIGTERM', 'SIGHUP']) {
40
+ process.on(sig, () => { child.kill(sig) })
44
41
  }
45
- process.exit(result.status ?? 1)
42
+ child.on('error', (error) => {
43
+ console.error('smith: ' + error.message)
44
+ process.exit(1)
45
+ })
46
+ child.on('exit', (code, signal) => {
47
+ if (signal) {
48
+ process.removeAllListeners(signal)
49
+ process.kill(process.pid, signal)
50
+ return
51
+ }
52
+ process.exit(code ?? 1)
53
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monosmith",
3
- "version": "2.0.0-beta.15",
3
+ "version": "2.0.0-beta.16",
4
4
  "description": "Runs a monorepo in Node, Go, Python, Rust, .NET, Ruby, PHP, C++, Dart, the JVM, Bicep, Lua, AppleScript, VBA, Swift and Objective-C: tasks from a cache, CI and releases",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/monosmith-app/monosmith",
@@ -18,11 +18,11 @@
18
18
  "node": "\u003e=18"
19
19
  },
20
20
  "optionalDependencies": {
21
- "@monosmith/cli-darwin-arm64": "2.0.0-beta.15",
22
- "@monosmith/cli-darwin-x64": "2.0.0-beta.15",
23
- "@monosmith/cli-linux-arm64": "2.0.0-beta.15",
24
- "@monosmith/cli-linux-x64": "2.0.0-beta.15",
25
- "@monosmith/cli-win32-arm64": "2.0.0-beta.15",
26
- "@monosmith/cli-win32-x64": "2.0.0-beta.15"
21
+ "@monosmith/cli-darwin-arm64": "2.0.0-beta.16",
22
+ "@monosmith/cli-darwin-x64": "2.0.0-beta.16",
23
+ "@monosmith/cli-linux-arm64": "2.0.0-beta.16",
24
+ "@monosmith/cli-linux-x64": "2.0.0-beta.16",
25
+ "@monosmith/cli-win32-arm64": "2.0.0-beta.16",
26
+ "@monosmith/cli-win32-x64": "2.0.0-beta.16"
27
27
  }
28
28
  }