@agoric/xsnap 0.14.3-u17.1 → 0.14.3-u18.1

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.
package/api.js CHANGED
@@ -7,7 +7,7 @@
7
7
  * Also, update golden master test/xs-perf.test.js to reflect new meter
8
8
  * version.
9
9
  */
10
- export const METER_TYPE = 'xs-meter-30';
10
+ export const METER_TYPE = 'xs-meter-33';
11
11
 
12
12
  export const ExitCode = {
13
13
  E_UNKNOWN_ERROR: -1,
package/build.env CHANGED
@@ -1,4 +1,4 @@
1
1
  MODDABLE_URL=https://github.com/agoric-labs/moddable.git
2
2
  MODDABLE_COMMIT_HASH=f6c5951fc055e4ca592b9166b9ae3cbb9cca6bf0
3
3
  XSNAP_NATIVE_URL=https://github.com/agoric-labs/xsnap-pub
4
- XSNAP_NATIVE_COMMIT_HASH=eef9b67da5517ed18ff9e0073b842db20924eae3
4
+ XSNAP_NATIVE_COMMIT_HASH=105bc6862050695b1723fa76df91564fe8111a37
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/xsnap",
3
- "version": "0.14.3-u17.1",
3
+ "version": "0.14.3-u18.1",
4
4
  "description": "Snapshotting VM worker based on Moddable's XS Javascript engine",
5
5
  "author": "Agoric",
6
6
  "license": "Apache-2.0",
@@ -24,29 +24,29 @@
24
24
  "lint:types": "tsc",
25
25
  "lint-fix": "eslint --fix 'src/**/*.js' 'test/**/*.js' api.js",
26
26
  "test": "ava",
27
- "test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
27
+ "test:c8": "c8 --all $C8_OPTIONS ava",
28
28
  "test:xs": "exit 0"
29
29
  },
30
30
  "dependencies": {
31
- "@agoric/internal": "^0.4.0-u17.1",
32
- "@agoric/xsnap-lockdown": "^0.14.1-u17.1",
33
- "@endo/bundle-source": "^3.4.0",
34
- "@endo/errors": "^1.2.5",
35
- "@endo/eventual-send": "^1.2.5",
36
- "@endo/init": "^1.1.4",
37
- "@endo/netstring": "^1.0.10",
38
- "@endo/promise-kit": "^1.1.5",
39
- "@endo/stream": "^1.2.5",
40
- "@endo/stream-node": "^1.1.5",
31
+ "@agoric/internal": "^0.4.0-u18.1",
32
+ "@agoric/xsnap-lockdown": "^0.14.1-u18.1",
33
+ "@endo/bundle-source": "^3.5.0",
34
+ "@endo/errors": "^1.2.8",
35
+ "@endo/eventual-send": "^1.2.8",
36
+ "@endo/init": "^1.1.7",
37
+ "@endo/netstring": "^1.0.13",
38
+ "@endo/promise-kit": "^1.1.8",
39
+ "@endo/stream": "^1.2.8",
40
+ "@endo/stream-node": "^1.1.8",
41
41
  "glob": "^7.1.6",
42
42
  "tmp": "^0.2.1"
43
43
  },
44
44
  "devDependencies": {
45
- "@endo/base64": "^1.0.7",
46
- "@endo/nat": "^5.0.10",
45
+ "@endo/base64": "^1.0.9",
46
+ "@endo/nat": "^5.0.13",
47
47
  "@types/glob": "^8.1.0",
48
48
  "ava": "^5.3.0",
49
- "c8": "^9.1.0"
49
+ "c8": "^10.1.2"
50
50
  },
51
51
  "files": [
52
52
  "LICENSE*",
@@ -76,7 +76,7 @@
76
76
  "workerThreads": false
77
77
  },
78
78
  "typeCoverage": {
79
- "atLeast": 94.04
79
+ "atLeast": 93.51
80
80
  },
81
- "gitHead": "5259430561693bfcf58516c3ea54123895859708"
81
+ "gitHead": "f8c45b8a2e29a51522a81a6692af25b2d7f6b50f"
82
82
  }
package/src/avaXS.js CHANGED
@@ -112,7 +112,7 @@ async function runTestScript(
112
112
  /**
113
113
  * Handle callback "command" from xsnap subprocess.
114
114
  *
115
- * @type { (msg: ArrayBuffer) => Promise<ArrayBuffer> }
115
+ * @type { (msg: ArrayBuffer) => Promise<Uint8Array<ArrayBufferLike>> }
116
116
  */
117
117
  async function handleCommand(message) {
118
118
  /**
package/src/build.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- /* global process */
2
+ /* eslint-env node */
3
3
  import * as childProcessTop from 'child_process';
4
4
  import { fileURLToPath } from 'url';
5
5
  import fsTop from 'fs';
package/src/globals.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- declare var issueCommand: (msg: ArrayBuffer) => ArrayBuffer;
1
+ declare var issueCommand: (msg: ArrayBufferLike) => ArrayBuffer;
2
2
 
3
3
  namespace global {
4
- declare var issueCommand: (msg: ArrayBuffer) => ArrayBuffer;
4
+ declare var issueCommand: (msg: ArrayBufferLike) => ArrayBuffer;
5
5
  }
package/src/replay.js CHANGED
@@ -326,7 +326,7 @@ export async function main(
326
326
  await replayXSnap(options, folders, { readdirSync, readFileSync });
327
327
  }
328
328
 
329
- /* global process */
329
+ /* eslint-env node */
330
330
  if (process.argv[1] === fileURLToPath(new URL(import.meta.url))) {
331
331
  main([...process.argv.slice(2)], {
332
332
  spawn: childProcessPowers.spawn,
package/src/xsnap.js CHANGED
@@ -1,4 +1,4 @@
1
- /* global process */
1
+ /* eslint-env node */
2
2
  /* eslint no-await-in-loop: ["off"] */
3
3
 
4
4
  import { finished } from 'stream/promises';
@@ -141,8 +141,8 @@ const makeSnapshotLoaderWithPipe = async (
141
141
  * @property {AsyncIterable<Uint8Array>} [snapshotStream]
142
142
  * @property {string} [snapshotDescription]
143
143
  * @property {boolean} [snapshotUseFs]
144
- * @property {'ignore' | 'inherit'} [stdout]
145
- * @property {'ignore' | 'inherit'} [stderr]
144
+ * @property {'ignore' | 'inherit' | 'pipe'} [stdout]
145
+ * @property {'ignore' | 'inherit' | 'pipe'} [stderr]
146
146
  * @property {number} [meteringLimit]
147
147
  * @property {Record<string, string>} [env]
148
148
  */
@@ -501,7 +501,6 @@ export async function xsnap(options) {
501
501
  if (cleaned) return;
502
502
  cleaned = true;
503
503
  sourceStream.unpipe(output);
504
- // eslint-disable-next-line no-use-before-define
505
504
  output.off('data', onData);
506
505
  output.end();
507
506
  };
package/src/xsrepl.js CHANGED
@@ -1,4 +1,4 @@
1
- /* global process */
1
+ /* eslint-env node */
2
2
  /* We make exceptions for test code. This is a test utility. */
3
3
  /* eslint no-await-in-loop: ["off"] */
4
4
 
@@ -58,6 +58,7 @@ static char* fxReadNetStringError(int code);
58
58
  static int fxWriteOkay(FILE* outStream, xsUnsignedValue meterIndex, xsMachine *the, char* buf, size_t len);
59
59
  static int fxWriteNetString(FILE* outStream, char* prefix, char* buf, size_t len);
60
60
  static char* fxWriteNetStringError(int code);
61
+ static void fxSigPipeHandler(int sigNum);
61
62
 
62
63
  extern xsIntegerValue fxGetCurrentHeapCount(xsMachine* the);
63
64
 
@@ -254,6 +255,14 @@ static char *renderTimestamps() {
254
255
  return timestampBuffer;
255
256
  }
256
257
 
258
+ static void fxSigPipeHandler(int sigNum)
259
+ {
260
+ if (sigNum == SIGPIPE) {
261
+ fprintf(stderr, "Caught SIGPIPE. Has parent died?\n");
262
+ c_exit(E_IO_ERROR);
263
+ }
264
+ }
265
+
257
266
  int main(int argc, char* argv[])
258
267
  {
259
268
  int argi;
@@ -396,6 +405,9 @@ int main(int argc, char* argv[])
396
405
  machine = xsCreateMachine(creation, "xsnap", NULL);
397
406
  xsBuildAgent(machine);
398
407
  }
408
+
409
+ signal(SIGPIPE, fxSigPipeHandler);
410
+
399
411
  if (!(fromParent = fdopen(3, "rb"))) {
400
412
  fprintf(stderr, "fdopen(3) from parent failed\n");
401
413
  c_exit(E_IO_ERROR);
@@ -931,6 +943,10 @@ static void xs_issueCommand(xsMachine *the)
931
943
  size_t len;
932
944
  int readError = fxReadNetString(fromParent, &buf, &len);
933
945
  if (readError != 0) {
946
+ if (feof(fromParent)) {
947
+ fprintf(stderr, "Got EOF on netstring read. Has parent died?\n");
948
+ c_exit(E_IO_ERROR);
949
+ }
934
950
  xsUnknownError(fxReadNetStringError(readError));
935
951
  }
936
952
  recordTimestamp(); // after command-result received from parent