Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function parseExitCode(buffer, defaultCode) {
var constants = require('karma/lib/constants');
var tailPos = buffer.length - Buffer.byteLength(constants.EXIT_CODE) - 1;
if (tailPos < 0) {
return defaultCode;
}
// tail buffer which might contain the message
var tail = buffer.slice(tailPos);
var tailStr = tail.toString();
if (tailStr.substr(0, tailStr.length - 1) === constants.EXIT_CODE) {
tail.fill('\x00');
return parseInt(tailStr.substr(-1), 10);
}
return defaultCode;
}
function parseExitCode(buffer, defaultCode) {
var constants = require('karma/lib/constants');
var tailPos = buffer.length - Buffer.byteLength(constants.EXIT_CODE) - 1;
if (tailPos < 0) {
return defaultCode;
}
// tail buffer which might contain the message
var tail = buffer.slice(tailPos);
var tailStr = tail.toString();
if (tailStr.substr(0, tailStr.length - 1) === constants.EXIT_CODE) {
tail.fill('\x00');
return parseInt(tailStr.substr(-1), 10);
}
return defaultCode;
}
function parseExitCode(buffer, defaultCode) {
var constants = require('karma/lib/constants');
var tailPos = buffer.length - Buffer.byteLength(constants.EXIT_CODE) - 1;
if (tailPos < 0) {
return defaultCode;
}
// tail buffer which might contain the message
var tail = buffer.slice(tailPos);
var tailStr = tail.toString();
if (tailStr.substr(0, tailStr.length - 1) === constants.EXIT_CODE) {
tail.fill('\x00');
return parseInt(tailStr.substr(-1), 10);
}
return defaultCode;
}
function parseExitCode(buffer, defaultCode) {
var constants = require('karma/lib/constants');
var tailPos = buffer.length - Buffer.byteLength(constants.EXIT_CODE) - 1;
if (tailPos < 0) {
return defaultCode;
}
// tail buffer which might contain the message
var tail = buffer.slice(tailPos);
var tailStr = tail.toString();
if (tailStr.substr(0, tailStr.length - 1) === constants.EXIT_CODE) {
tail.fill('\x00');
return parseInt(tailStr.substr(-1), 10);
}
return defaultCode;
}
emitter.once('run_complete', function (browsers, results) {
reporter.removeAdapter(responseWrite);
response.end(constant.EXIT_CODE + results.exitCode);
});
});
emitter.once('run_complete', function (browsers, results) {
reporter.removeAdapter(responseWrite);
response.end(constant.EXIT_CODE + results.exitCode);
});
});