Skip to content

Commit

Permalink
Merge pull request #282 from prey/logon-user-wipe
Browse files Browse the repository at this point in the history
Wipe action without user logged in
  • Loading branch information
javo authored May 2, 2017
2 parents 537b31e + 491ed9b commit f2afbc3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/agent/actions/wipe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var join = require('path').join,
Emitter = require('events').EventEmitter,
wipe = require('./wipe'),
common = require('./../../common'),
os_name = common.os_name,
logger = common.logger.prefix('wipe'),
system = common.system;

Expand All @@ -10,7 +11,7 @@ var emitter,

var node_bin = join(system.paths.current, 'bin', 'node');

if (common.os_name == 'windows')
if (os_name == 'windows')
node_bin = node_bin + '.exe';

var valid_types = function(hash) {
Expand Down Expand Up @@ -63,7 +64,14 @@ exports.start = function(opts, cb) {
var args = [join(__dirname, 'runner.js')].concat(items);

system.spawn_as_logged_user(node_bin, args, function(err, child) {
if (err) return finished(err);
if (err) {
if (err.toString().includes('No logged user') && os_name == 'windows') {
logger.warn('Not logged user found, proceding without impersonation')
queue(items);
}
else
return finished(err);
}

child.stdout.on('data', function(str) {
var lines = str.toString().split(/\n/);
Expand Down

0 comments on commit f2afbc3

Please sign in to comment.