dsh-ris-ide 1.8.1 → 1.8.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 (47) hide show
  1. package/README.md +2 -2
  2. package/lib/client.js +311 -72
  3. package/lib/debug/vendor/README.md +14 -0
  4. package/lib/debug/vendor/jdwp/client.js +9 -4
  5. package/lib/debug/vendor/src/jdwp/client.ts +12 -5
  6. package/lib/index.js +794 -48
  7. package/lib/redirector.js +42 -2
  8. package/lib/risd/lifecycle.js +9 -3
  9. package/lib/risd/server.js +308 -13
  10. package/lib/risd/ui.js +149 -112
  11. package/lib/risd-client.js +4 -1
  12. package/lib/startup.js +27 -7
  13. package/package.json +2 -2
  14. package/test/client-viewer.test.mjs +188 -95
  15. package/test/clipboard.test.mjs +259 -0
  16. package/test/debug-engine.test.mjs +3 -1
  17. package/test/dsh-origin.test.mjs +4 -11
  18. package/test/dsh-window-refresh.test.mjs +166 -1
  19. package/test/harness.test.mjs +1 -1
  20. package/test/helpers/cmd.mjs +29 -0
  21. package/test/helpers/tgz.mjs +71 -0
  22. package/test/host-search.test.mjs +18 -11
  23. package/test/host-tail.test.mjs +119 -24
  24. package/test/proxy-route.test.mjs +61 -0
  25. package/test/proxy-window.test.mjs +5 -0
  26. package/test/proxy.test.mjs +13 -1
  27. package/test/proxybridge-bundle.test.mjs +1 -59
  28. package/test/redirector-bundle.test.mjs +21 -67
  29. package/test/redirector.test.mjs +41 -4
  30. package/test/risd-api.test.mjs +81 -28
  31. package/test/risd-bridge-degrade.test.mjs +3 -29
  32. package/test/risd-engine.test.mjs +13 -50
  33. package/test/risd-entry.test.mjs +0 -37
  34. package/test/risd-follow-start.test.mjs +101 -0
  35. package/test/risd-git.test.mjs +7 -5
  36. package/test/risd-handoff.test.mjs +6 -50
  37. package/test/risd-helpers.mjs +150 -3
  38. package/test/risd-host-p2.test.mjs +2 -30
  39. package/test/risd-lifecycle.test.mjs +25 -0
  40. package/test/risd-programs.test.mjs +4 -34
  41. package/test/risd-review-p2.test.mjs +0 -13
  42. package/test/risd-shutdown.test.mjs +5 -38
  43. package/test/risd-teardown.test.mjs +8 -27
  44. package/test/risd-ui.test.mjs +169 -13
  45. package/test/risd-write.test.mjs +2 -1
  46. package/test/startup-reconcile.test.mjs +44 -8
  47. package/test/proxy-restart.test.mjs +0 -39
@@ -178,6 +178,7 @@ export class JDWPClient extends EventEmitter {
178
178
  const pending = this.pendingRequests.get(id);
179
179
  if (pending) {
180
180
  this.pendingRequests.delete(id);
181
+ clearTimeout(pending.timer);
181
182
  pending.resolve({ id, flags: FLAGS_REPLY, errorCode, data });
182
183
  }
183
184
  }
@@ -308,15 +309,19 @@ export class JDWPClient extends EventEmitter {
308
309
  }
309
310
  const id = this.nextId++;
310
311
  const packet = buildCommandPacket(id, commandSet, command, data);
311
- this.pendingRequests.set(id, { resolve, reject });
312
- this.socket.write(packet);
313
- // Timeout after 10 seconds
314
- setTimeout(() => {
312
+ // The timeout is kept with the request so the reply can clear it: a timer
313
+ // left behind per command keeps the event loop alive for 10 s after the
314
+ // last command (a test run then hangs for seconds), and a long debug
315
+ // session would accumulate one timer per command.
316
+ const timer = setTimeout(() => {
315
317
  if (this.pendingRequests.has(id)) {
316
318
  this.pendingRequests.delete(id);
317
319
  reject(new Error(`Command timeout: cmdSet=${commandSet}, cmd=${command}`));
318
320
  }
319
321
  }, 10000);
322
+ timer.unref?.();
323
+ this.pendingRequests.set(id, { resolve, reject, timer });
324
+ this.socket.write(packet);
320
325
  });
321
326
  }
322
327
  checkError(reply) {
@@ -75,6 +75,8 @@ export interface VariableInfo {
75
75
  interface PendingRequest {
76
76
  resolve: (reply: ReplyPacket) => void;
77
77
  reject: (err: Error) => void;
78
+ /** The per-command watchdog, cleared by the reply (see `sendCommand`). */
79
+ timer?: ReturnType<typeof setTimeout>;
78
80
  }
79
81
 
80
82
  /**
@@ -278,6 +280,7 @@ export class JDWPClient extends EventEmitter {
278
280
  const pending = this.pendingRequests.get(id);
279
281
  if (pending) {
280
282
  this.pendingRequests.delete(id);
283
+ clearTimeout(pending.timer);
281
284
  pending.resolve({ id, flags: FLAGS_REPLY, errorCode, data });
282
285
  }
283
286
  } else {
@@ -417,16 +420,20 @@ export class JDWPClient extends EventEmitter {
417
420
  const id = this.nextId++;
418
421
  const packet = buildCommandPacket(id, commandSet, command, data);
419
422
 
420
- this.pendingRequests.set(id, { resolve, reject });
421
- this.socket.write(packet);
422
-
423
- // Timeout after 10 seconds
424
- setTimeout(() => {
423
+ // The timeout is kept with the request so the reply can clear it: a timer
424
+ // left behind per command keeps the event loop alive for 10 s after the last
425
+ // command (a test run then hangs for seconds), and a long debug session would
426
+ // accumulate one timer per command.
427
+ const timer = setTimeout(() => {
425
428
  if (this.pendingRequests.has(id)) {
426
429
  this.pendingRequests.delete(id);
427
430
  reject(new Error(`Command timeout: cmdSet=${commandSet}, cmd=${command}`));
428
431
  }
429
432
  }, 10000);
433
+ timer.unref?.();
434
+
435
+ this.pendingRequests.set(id, { resolve, reject, timer });
436
+ this.socket.write(packet);
430
437
  });
431
438
  }
432
439