Run command synchronously with administrator privilege.
npm install runas
npm install
grunt
to compile the native and CoffeeScript codegrunt test
to run the specsrunas = require 'runas'
options
Object
hide
Boolean - Hide the console window, true
by default.admin
Boolean - Run command as administrator, false
by default.catchOutput
Boolean - Catch the stdout and stderr of the command, false
by default.stdin
String - 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.
admin
option has only been implemented on Windows and OS X.stdin
option has only been implemented on POSIX systems.hide
option is only meaningful on Windows.catchOutput
is true
,
exitCode
, stdout
and stderr
will be returned,admin
is false
, exitCode
, stdout
and stderr
will be returned,admin
is true
, exitCode
and stdout
will be returned,exitCode
will be returned.