Skip to content

Commit

Permalink
fix(xsnap): incorporate PR review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
siarhei-agoric committed Sep 20, 2024
1 parent 5842d5e commit 9b25064
Show file tree
Hide file tree
Showing 2 changed files with 140 additions and 203 deletions.
24 changes: 24 additions & 0 deletions packages/xsnap/test/fixture-xsnap-eof.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import console from 'console';
import * as proc from 'child_process';
import * as os from 'os';
import fs from 'fs';
import process from 'node:process';
import { tmpName } from 'tmp';
import '@endo/init';
import { xsnap } from '../src/xsnap.js';
import { options } from './message-tools.js';

const io = { spawn: proc.spawn, os: os.type(), fs, tmpName };

async function handleCommand(_message) {
process.kill(process.pid, 'SIGKILL');
return new Uint8Array();
}

const vat = await xsnap({ ...options(io), handleCommand });
await vat.evaluate(
'function handleCommand(message) { issueCommand(new Uint8Array().buffer); };',
);
await vat.issueStringCommand('0');
console.error('Error: parent was not killed!');
await vat.close();
Loading

0 comments on commit 9b25064

Please sign in to comment.