-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(xsnap): incorporate PR review suggestions
- Loading branch information
1 parent
5842d5e
commit 9b25064
Showing
2 changed files
with
140 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
Oops, something went wrong.