@agoric/xsnap 0.14.3-dev-4a1e4c3.0 → 0.14.3-dev-7ceb7f7.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.
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-dev-4a1e4c3.0+4a1e4c3",
3
+ "version": "0.14.3-dev-7ceb7f7.0+7ceb7f7",
4
4
  "description": "Snapshotting VM worker based on Moddable's XS Javascript engine",
5
5
  "author": "Agoric",
6
6
  "license": "Apache-2.0",
@@ -28,8 +28,8 @@
28
28
  "test:xs": "exit 0"
29
29
  },
30
30
  "dependencies": {
31
- "@agoric/internal": "0.3.3-dev-4a1e4c3.0+4a1e4c3",
32
- "@agoric/xsnap-lockdown": "0.14.1-dev-4a1e4c3.0+4a1e4c3",
31
+ "@agoric/internal": "0.3.3-dev-7ceb7f7.0+7ceb7f7",
32
+ "@agoric/xsnap-lockdown": "0.14.1-dev-7ceb7f7.0+7ceb7f7",
33
33
  "@endo/bundle-source": "^3.4.0",
34
34
  "@endo/errors": "^1.2.5",
35
35
  "@endo/eventual-send": "^1.2.5",
@@ -78,5 +78,5 @@
78
78
  "typeCoverage": {
79
79
  "atLeast": 94.04
80
80
  },
81
- "gitHead": "4a1e4c38ee972c8836aa74acaccb0251dec97638"
81
+ "gitHead": "7ceb7f7f2b618179098442fc103f636f989474b6"
82
82
  }
package/src/xsnap.js CHANGED
@@ -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
  */
@@ -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