Socket
Socket
Sign inDemoInstall

@secret-agent/puppet

Package Overview
Dependencies
17
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.5.6 to 1.5.7

lib/PipeTransport.d.ts

4

index.js

@@ -29,3 +29,2 @@ "use strict";

async start(attachToDevtools) {
var _a;
try {

@@ -39,4 +38,3 @@ this.isStarted = true;

this.browser.onDevtoolsAttached = attachToDevtools;
const features = await this.browser.getFeatures();
this.supportsBrowserContextProxy = (_a = features === null || features === void 0 ? void 0 : features.supportsPerBrowserContextProxy) !== null && _a !== void 0 ? _a : false;
this.supportsBrowserContextProxy = this.browser.majorVersion >= 85;
return this;

@@ -43,0 +41,0 @@ }

@@ -23,11 +23,10 @@ "use strict";

const Logger_1 = require("@secret-agent/commons/Logger");
const Resolvable_1 = require("@secret-agent/commons/Resolvable");
const Fs = require("fs");
const ShutdownHandler_1 = require("@secret-agent/commons/ShutdownHandler");
const WebSocketTransport_1 = require("./WebSocketTransport");
const PipeTransport_1 = require("./PipeTransport");
const { log } = Logger_1.default(module);
const logProcessExit = process.env.NODE_ENV !== 'test';
async function launchProcess(executablePath, processArguments, onClose, env) {
function launchProcess(executablePath, processArguments, onClose, env) {
var _a, _b;
const stdio = ['ignore', 'pipe', 'pipe'];
const stdio = ['ignore', 'pipe', 'pipe', 'pipe', 'pipe'];
log.info(`Puppet.LaunchProcess`, { sessionId: null, executablePath, processArguments });

@@ -61,3 +60,2 @@ const launchedProcess = childProcess.spawn(executablePath, processArguments, {

});
const websocketEndpointResolvable = new Resolvable_1.default();
const stderr = readline.createInterface({ input: launchedProcess.stderr });

@@ -67,5 +65,2 @@ stderr.on('line', line => {

return;
const match = line.match(/DevTools listening on (.*)/);
if (match)
websocketEndpointResolvable.resolve(match[1].trim());
log.warn(`${exe}.stderr`, { message: line, sessionId: null });

@@ -85,12 +80,7 @@ });

processKilled = true;
if (!websocketEndpointResolvable.isResolved) {
websocketEndpointResolvable.reject(new Error('Chrome exited during launch'));
try {
transport === null || transport === void 0 ? void 0 : transport.close();
}
else {
try {
transport === null || transport === void 0 ? void 0 : transport.close();
}
catch (error) {
// drown
}
catch (error) {
// drown
}

@@ -106,5 +96,5 @@ if (logProcessExit) {

ShutdownHandler_1.default.register(close);
const wsEndpoint = await websocketEndpointResolvable.promise;
transport = new WebSocketTransport_1.WebSocketTransport(wsEndpoint);
await transport.waitForOpen;
const { 3: pipeWrite, 4: pipeRead } = launchedProcess.stdio;
transport = new PipeTransport_1.PipeTransport(pipeWrite, pipeRead);
transport.onCloseFns.push(this.close);
return Promise.resolve({

@@ -115,22 +105,18 @@ transport,

async function close() {
if (launchedProcess.killed || processKilled)
return;
try {
transport.close();
}
catch (error) {
// drown
}
try {
const closed = new Promise(resolve => launchedProcess.once('exit', resolve));
if (process.platform === 'win32') {
childProcess.execSync(`taskkill /pid ${launchedProcess.pid} /T /F 2> nul`);
// attempt graceful close, but don't wait
if (transport) {
transport.end(JSON.stringify({ method: 'Browser.close', id: -1 }));
}
else {
launchedProcess.kill('SIGKILL');
if (!launchedProcess.killed && !processKilled) {
const closed = new Promise(resolve => launchedProcess.once('exit', resolve));
if (process.platform === 'win32') {
childProcess.execSync(`taskkill /pid ${launchedProcess.pid} /T /F 2> nul`);
}
else {
launchedProcess.kill('SIGKILL');
}
launchedProcess.emit('exit');
await closed;
}
if (dataDir)
cleanDataDir(dataDir);
await closed;
runOnClose();
}

@@ -137,0 +123,0 @@ catch (error) {

{
"name": "@secret-agent/puppet",
"version": "1.5.6",
"version": "1.5.7",
"description": "Puppet driver",

@@ -25,8 +25,8 @@ "main": "index.js",

"dependencies": {
"@secret-agent/commons": "1.5.6",
"@secret-agent/interfaces": "1.5.6",
"@secret-agent/puppet-chrome": "1.5.6",
"@secret-agent/commons": "1.5.7",
"@secret-agent/interfaces": "1.5.7",
"@secret-agent/puppet-chrome": "1.5.7",
"ws": "^7.4.4"
},
"gitHead": "252876c6045f0a18143d1c56ca238358b664d578"
"gitHead": "21acc1de4f02d472dfed6e1393d4d6f27278c668"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc