kernel-sandbox/bin/sandbox.js

20 lines
526 B
JavaScript
Raw Normal View History

2022-07-20 17:51:16 +00:00
#!/usr/bin/env node
// @ts-ignore
2022-07-20 18:06:18 +00:00
import { loadTester, login } from "../dist/index.js";
2022-07-20 18:28:07 +00:00
import puppeteer, { ProtocolError } from "puppeteer";
2022-07-20 17:51:16 +00:00
let browser;
(async () => {
2022-07-20 18:06:18 +00:00
browser = await puppeteer.launch({ headless: false, devtools: true });
2022-07-20 17:51:16 +00:00
const page = (await browser.pages()).pop();
2022-07-20 18:06:18 +00:00
await login(page);
await loadTester(page);
2022-07-20 17:51:16 +00:00
})();
process.on("SIGTERM", async () => {
await browser.close();
});
2022-07-20 18:28:07 +00:00
process.on("uncaughtException", (e) => {
if (!(e instanceof ProtocolError)) {
throw e;
}
});