@rallycry/conveyor-k3 0.1.7 → 0.1.8

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/dist/vm-qemu.js +16 -4
  2. package/package.json +1 -1
package/dist/vm-qemu.js CHANGED
@@ -683,6 +683,17 @@ function runRelayNow(root, invocation, io) {
683
683
  input: process.stdin,
684
684
  output: process.stdout
685
685
  };
686
+ const signals = ["SIGINT", "SIGTERM", "SIGHUP"];
687
+ const cleanup = () => {
688
+ try {
689
+ unregisterRelay(root, record);
690
+ } catch {
691
+ }
692
+ };
693
+ const terminated = (signal) => {
694
+ finish(new Error("VM relay terminated"));
695
+ process.kill(process.pid, signal);
696
+ };
686
697
  const finish = (error) => {
687
698
  if (finished) return;
688
699
  finished = true;
@@ -690,13 +701,14 @@ function runRelayNow(root, invocation, io) {
690
701
  if (connectTimer) clearTimeout(connectTimer);
691
702
  socket.destroy();
692
703
  input.destroy();
693
- try {
694
- unregisterRelay(root, record);
695
- } catch {
696
- }
704
+ for (const signal of signals) process.removeListener(signal, terminated);
705
+ process.removeListener("exit", cleanup);
706
+ cleanup();
697
707
  if (error) process.exitCode = 1;
698
708
  resolve();
699
709
  };
710
+ process.once("exit", cleanup);
711
+ for (const signal of signals) process.once(signal, terminated);
700
712
  const exceedsLimit = (total) => total > MAX_RELAY_BYTES;
701
713
  socket.setTimeout(RELAY_IDLE_MS, () => finish(new Error("VM relay idle timeout")));
702
714
  socket.once("connect", () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rallycry/conveyor-k3",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Managed personal compute for Conveyor. Installs and maintains a k3s cluster that runs your own card builds, kept converged on Conveyor's desired state.",
5
5
  "keywords": [
6
6
  "cloudflared",