linkr-bee-cli 1.1.3 → 1.1.4

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.
@@ -1,6 +1,6 @@
1
1
  # Third-party components
2
2
 
3
- Linkr Bee Terminal 1.1.2 is licensed under Apache-2.0.
3
+ Linkr Bee Terminal 1.1.4 is licensed under Apache-2.0.
4
4
 
5
5
  This file is generated from the crate's `Cargo.lock`, `cargo metadata` and
6
6
  `cargo tree`. It lists the normal-dependency closure across all targets
package/bin/bee-cli.js CHANGED
@@ -20,22 +20,34 @@ async function main() {
20
20
  process.exit(1)
21
21
  }
22
22
  const child = spawn(binary, process.argv.slice(2), { stdio: 'inherit' })
23
+ // Keep the listeners so they can be removed again: a re-raised signal that
24
+ // this process still handles would be forwarded to a dead child and ignored.
25
+ const relays = new Map()
23
26
  for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP', 'SIGQUIT']) {
24
- process.on(signal, () => {
27
+ const relay = () => {
25
28
  try {
26
29
  child.kill(signal)
27
30
  } catch {
28
31
  /* the child is already gone */
29
32
  }
30
- })
33
+ }
34
+ relays.set(signal, relay)
35
+ process.on(signal, relay)
31
36
  }
32
37
  child.on('error', (error) => {
33
38
  process.stderr.write(`bee-cli: cannot run ${binary}: ${error.message}\n`)
34
39
  process.exit(1)
35
40
  })
36
41
  child.on('exit', (code, signal) => {
37
- if (signal) process.kill(process.pid, signal)
38
- else process.exit(code === null ? 1 : code)
42
+ if (!signal) {
43
+ process.exit(code === null ? 1 : code)
44
+ return
45
+ }
46
+ // Die the way the child died — but stop listening first, or this process
47
+ // catches its own re-raised signal, forwards it to a dead child and lives
48
+ // on, which is how a Ctrl-C in a terminal left the launcher running.
49
+ for (const [name, relay] of relays) process.removeListener(name, relay)
50
+ process.kill(process.pid, signal)
39
51
  })
40
52
  }
41
53
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkr-bee-cli",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Linkr Bee wireless serial bridge: the command-line client (bee-cli) for talking to a board's UART console over Bluetooth LE, LAN or loopback.",
5
5
  "keywords": [
6
6
  "bee-cli",