Add runas as devDependencies, or the python script will install it again and again.

The options of register_msdia80_dll.js should be admin.
Fix the problem of runas not works cause it will escape command parameters by default.
This commit is contained in:
Yonggang Luo 2015-03-21 15:22:45 +08:00
parent 24d615d428
commit fa011c3d97
3 changed files with 11 additions and 19 deletions

View file

@ -2,11 +2,16 @@ var fs = require('fs');
var path = require('path');
var runas = require('runas');
/* FIXME: C:\\Program Files\\ should comes from env variable
And for 32 bit msdia80 is should be placed at %ProgramFiles(x86)% */
var source = path.resolve(__dirname, '..', '..', 'vendor', 'breakpad', 'msdia80.dll');
var target = 'C:\\Program Files\\Common Files\\Microsoft Shared\\VC\\msdia80.dll';
if (fs.existsSync(target))
return;
var copy = 'copy "' + source + '" "' + target + '"';
var register = 'regsvr32 "' + target + '"';
runas('cmd', ['/K', copy + ' & ' + register + ' & exit']);
runas('cmd', ['/K',
'copy', source, target,
'&', 'regsvr32', '/s', target,
'&', 'exit'],
{admin:true}
);