Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function(stdout) {
var resolvedPath = stdout.trim(); // remove newline.
if (!resolvedPath) {
return tryRemainingPaths(pathsToTry);
}
logger.debug('Found storage path %s --> %s', path, resolvedPath);
// Return the resolved path (e.g. '/sdcard' not '$EXTERNAL_STORAGE'),
// so the caller can `adb push/pull` files to the absolute path.
this.storagePath_ = resolvedPath;
return resolvedPath;
}.bind(this));
}.bind(this));
process_utils.scheduleGetAll(this.app_).then(function(processInfos) {
var pid = process.pid;
var pi; // Declare outside the loop, to avoid a jshint warning
while (pid) {
pi = undefined;
for (var i = 0; i < processInfos.length; ++i) {
if (processInfos[i].pid === pid) {
pi = processInfos.splice(i, 1)[0];
logger.debug('Not killing user %s pid=%s: %s %s', process.env.USER,
pid, pi.command, pi.args.join(' '));
break;
}
}
pid = (pi ? pi.ppid : undefined);
}
if (processInfos.length > 0) {
logger.info('Killing %s pids owned by user %s: %s', processInfos.length,
process.env.USER,
processInfos.map(function(pi) { return pi.pid; }).join(', '));
process_utils.scheduleKillAll(
this.app_, 'Kill dangling pids', processInfos);
}
}.bind(this), function(e) {
logger.error('Unable to killall pids: ' + e.message);
return app.schedule(cmd, function() {
logger.debug('Exec with timeout(%d): %s', timeout, cmd);
// Create output buffers
var stdout = '';
var stderr = '';
function newMsg(desc, code, signal) {
function crop(s, n) {
return (s.length <= n ? s : s.substring(0, n - 3) + '...');
}
var ret = [desc, code && 'code ' + code, signal && 'signal ' + signal,
stdout && 'stdout[' + stdout.length + '] ' + crop(stdout, 1024),
stderr && 'stderr[' + stderr.length + '] ' + crop(stderr, 1024)];
// Comma-separated elements of ret, except the undefined ones.
return ret.filter(function(v) { return !!v; }).join(', ');
}
function newError(desc, code, signal) {
var ret = new Error(newMsg(desc, code, signal));
WebDriverServer.prototype.saveScreenshot_ = function(
fileName, screenshot, description) {
'use strict';
logger.debug('Saving screenshot %s (%d bytes): %s',
fileName, screenshot.length, description);
var diskPath = path.join(this.runTempDir_, fileName);
return process_utils.scheduleFunction(this.app_,
'Write screenshot file ' + diskPath,
fs.writeFile, diskPath, screenshot).then(function() {
return this.addScreenshot_(fileName, diskPath, description);
}.bind(this));
};
CD.curr(`SUM_TSW_ALPHA_LOG_KEY.${currDays}`, logNumMax, 24 * 60 * 60).fail(function (err) {
logger.debug(err && err.stack);
returnJson('服务器错误');
}).done(function (count) {
count = ~~count;
fs.utimes(filename, atime || new Date(), mtime || new Date(), function(err) {
if (err) {
logger.debug(err.stack);
return;
}
logger.debug(`[updateMtime] ${filename} succ`);
});
};