Run command synchronously with administrator privilege.
npm install runas- Clone the repository
- Run
npm install - Run
gruntto compile the native and CoffeeScript code - Run
grunt testto run the specs
runas = require 'runas'optionsObjecthideBoolean - Hide the console window,trueby default.adminBoolean - Run command as administrator,falseby default.catchOutputBoolean - Catch the stdout and stderr of the command,falseby default.stdinString - String which would be passed as stdin input.
Launches a new process with the given command, with command line arguments in
args.
This function is synchronous and returns the exit code when the command
finished.
When the catchOutput option is specified to true, an object that contains
exitCode, stdout and stderr will be returned.
- The
adminoption has only been implemented on Windows and OS X. - The
stdinoption has only been implemented on POSIX systems. - The
hideoption is only meaningful on Windows. - When
catchOutputistrue,- on Linux
exitCode,stdoutandstderrwill be returned, - on OS X
- if
adminisfalse,exitCode,stdoutandstderrwill be returned, - if
administrue,exitCodeandstdoutwill be returned,
- if
- on Windows only
exitCodewill be returned.
- on Linux