mikser-io 9.93.0 → 9.96.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 (3) hide show
  1. package/app.js +21 -1
  2. package/package.json +1 -1
  3. package/src/instance.js +14 -2
package/app.js CHANGED
@@ -32,6 +32,21 @@ function locate(argv) {
32
32
  // exited with nothing on the port.
33
33
  const longRunning = has('--watch', '-w', '--server', '-s')
34
34
 
35
+ // Answerable without an engine, and therefore never forwarded.
36
+ //
37
+ // `--help` and `--version` do not describe a build: commander answers them
38
+ // from the option table and exits. Forwarding them sent an instance a
39
+ // request it could not recognise — commander does not list help among the
40
+ // options parseOptions reports on — so refuseUnknownFlags rejected
41
+ // `--help` as an unknown flag, with a detail line claiming "the same
42
+ // command with nothing listening would have been rejected too", which is
43
+ // the opposite of true: with nothing listening it prints the help.
44
+ //
45
+ // Which made the help unreachable in exactly the situation that sends
46
+ // someone to it — a watcher running, wondering which check answers which
47
+ // question — and made a correct refusal say something false.
48
+ const answeredLocally = has('--help', '-h', '--version', '-V')
49
+
35
50
  // What to ask the instance for. Report-only commands go over the same
36
51
  // socket as a build: they read, so running them locally never damaged
37
52
  // anything, but a catalogue being written by another process is not a
@@ -56,6 +71,7 @@ function locate(argv) {
56
71
 
57
72
  return {
58
73
  longRunning,
74
+ answeredLocally,
59
75
  // The flags this process was invoked with, forwarded so the INSTANCE
60
76
  // can reject an unknown one. This pre-parser reads the few options it
61
77
  // needs and passes the rest along, so commander never runs on a
@@ -85,7 +101,11 @@ async function main() {
85
101
  }
86
102
  }
87
103
 
88
- if (!where.longRunning) {
104
+ // `--help` and `--version` never travel. Commander answers them from the
105
+ // option table and exits, so there is nothing to ask an instance for — and
106
+ // asking got them refused as unknown flags, since commander does not list
107
+ // help among the options parseOptions reports on.
108
+ if (!where.longRunning && !where.answeredLocally) {
89
109
  const code = await forward({
90
110
  workingFolder,
91
111
  config: path.resolve(where.workingFolder, where.config),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mikser-io",
3
- "version": "9.93.0",
3
+ "version": "9.96.0",
4
4
  "files": [
5
5
  "app.js",
6
6
  "index.js",
package/src/instance.js CHANGED
@@ -360,12 +360,24 @@ function refuseClear(socket, request) {
360
360
  return true
361
361
  }
362
362
 
363
+ // Which process to restart.
364
+ //
365
+ // "Restart it" is only actionable if you know which `it` — and the machine
366
+ // that hits this is the machine running several instances from several
367
+ // projects, because that is what makes a stale config likely in the first
368
+ // place. Without the pid, finding it meant walking /proc by cwd.
369
+ //
370
+ // The instance answers with its OWN pid, which is the one fact a client cannot
371
+ // work out: it knows the folder it asked about, not who is holding it. The
372
+ // wrong-config refusal beside this one already names both sides; this one
373
+ // named neither.
363
374
  function refuseStale(socket, movedFile) {
364
375
  frame(socket, {
365
376
  type: 'refused',
366
377
  reason: `this instance's config changed on disk since it started (${movedFile}).`,
367
- detail: 'It is still running the old one. Restart it, and this command will reach an instance that '
368
- + 'matches what you edited.',
378
+ detail: `It is still running the old one pid ${process.pid}, started in `
379
+ + `${runtime.options.workingFolder}. Restart that process and this command will reach an `
380
+ + 'instance that matches what you edited.',
369
381
  })
370
382
  }
371
383