Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wipe action without user logged in #282

Merged
merged 1 commit into from
May 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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