Socket
Socket
Sign inDemoInstall

@ciscospark/bin-sauce-connect

Package Overview
Dependencies
Maintainers
6
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ciscospark/bin-sauce-connect - npm Package Compare versions

Comparing version 0.7.0-alpha.f22f099e to 0.7.0

README.md

14

package.json
{
"name": "@ciscospark/bin-sauce-connect",
"version": "0.7.0-alpha.f22f099e",
"version": "0.7.0",
"description": "",
"license": "MIT",
"bin": {
"sauce-connect": "./bin/sauce-connect"
},
"repository": "https://github.com/ciscospark/spark-js-sdk/tree/master/packages/bin-sauce-connect",
"dependencies": {

@@ -18,2 +20,3 @@ "babel-plugin-lodash": "2.1.0",

"denodeify": "^1.2.1",
"dotenv": "^2.0.0",
"lodash": "^4.5.1",

@@ -23,6 +26,9 @@ "mkdirp": "^0.5.1"

"devDependencies": {
"babel-eslint": "^6.0.0-beta.5",
"eslint": "2.2.0",
"eslint-plugin-mocha-only": "0.0.3"
"babel-eslint": "^6.1.2",
"eslint": "^3.5.0",
"eslint-plugin-mocha": "^4.5.1"
},
"engines": {
"node": ">=4"
}
}
import path from 'path';
export const dotSauce = path.join(__dirname, `..`, `..`, `.sauce`);
export const dotSauce = path.join(__dirname, `..`, `..`, `..`, `..`, `.sauce${process.env.PACKAGE ? `/${process.env.PACKAGE}` : ``}`);
export const logFile = path.join(dotSauce, `sauce_connect.log`);
export const pidFile = path.join(dotSauce, `sc.pid`);
export const readyFile = path.join(dotSauce, `sc.ready`);

@@ -7,6 +7,7 @@ import 'babel-polyfill';

import spawn from './lib/spawn';
import rm from './lib/rm';
const mkdirp = denodeify(_mkdirp);
const SAUCE_CONNECT_VERSION = `4.3.11`;
const SAUCE_CONNECT_VERSION = `4.3.16`;

@@ -63,3 +64,6 @@ (async function run() {

// eslint-disable-next-line prefer-const
let interval;
// cancel the connect process if the ready file hasn't been detected within
// 60 seconds
const timer = setTimeout(async function failAfter() {

@@ -75,2 +79,3 @@ clearInterval(interval);

// Check for the ready file once per second forever until it exists
interval = setInterval(async function checkConnected() {

@@ -93,3 +98,3 @@ if (await exists(readyFile)) {

`-vv`,
`-l`, `sauce_connect.log`,
`-l`, `${logFile}`,
`--pidfile`, pidFile,

@@ -104,2 +109,30 @@ `--readyfile`, readyFile,

/**
* Prevents the next connection attempt until the pid file from the previous
* attempt disappears (or the tiemout expires and we remove it forcibly)
* @returns {Promise}
*/
function blockUntilClosed() {
return new Promise((resolve) => {
// eslint-disable-next-line prefer-const
let interval;
const timer = setTimeout(async function removeAfter() {
clearInterval(interval);
if (await exists(pidFile)) {
console.log(`pid file not removed; forcibly removing`);
await rm(pidFile);
resolve();
}
}, 60 * 1000);
interval = setInterval(async function check() {
if (!await exists(pidFile)) {
clearTimeout(timer);
clearInterval(interval);
resolve();
}
}, 1000);
});
}
/**
* Connect to Sauce Labs with up to three attempts

@@ -116,2 +149,3 @@ * @private

try {
await blockUntilClosed();
await connect();

@@ -122,2 +156,3 @@ }

try {
await blockUntilClosed();
await connect();

@@ -124,0 +159,0 @@ }

@@ -15,2 +15,3 @@ import 'babel-polyfill';

await new Promise((resolve, reject) => {
// eslint-disable-next-line prefer-const
let interval;

@@ -17,0 +18,0 @@ const timeout = setTimeout(() => {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc