2.2.3 • Published 7 years ago

elevator v2.2.3

Weekly downloads
18
License
MIT
Repository
github
Last release
7 years ago

elevator

Windows UAC elevation that just works.

npm version dependencies Build status Gitter(https://badges.gitter.im/Join Chat.svg)

Description

This module is a thin wrapper around the awesome elevate.exe utility by kliu, which is a small C open source application with x64 and ia32 support that just works.

This module doesn't make use of NodeJS C/C++ bindings and instead relies on executing the .exe file direcly in a way that is electron friendly even when the application is packaged in an asar archive.

Of course, this means that this NodeJS module is subjected to the Windows versions and architectures such supports. Windows Vista (or newer) is required.

Installation

Install elevator by running:

$ npm install --save elevator

Documentation

elevator.execute(command, options, callback)

This function will yield an Error containing a code that equals ELEVATE_CANCELLED if the elevation was cancelled by the user.

Kind: static method of elevator
Summary: Execute a command with UAC elevation
Access: public

ParamTypeDefaultDescription
commandArray.<String>command
optionsObject{}options
options.terminatingBooleanLaunches a terminating command processor; equivalent to "cmd /c command".
options.persistentBooleanLaunches a persistent command processor; equivalent to "cmd /k command".
options.doNotPushdCurrentDirectoryBooleanWhen using -c or -k, do not pushd the current directory before execution.
options.unicodeBooleanWhen using -c or -k, use Unicode; equivalent to "cmd /u".
options.hiddenBooleanWhen using -c or -k, start "cmd" in hidden mode.
options.waitForTerminationBooleanWaits for termination; equivalent to "start /wait command".
callbackfunctioncallback (error, stdout, stderr)

Example

elevator.execute([ 'cmd.exe' ], {
  waitForTermination: true
}, function(error, stdout, stderr) {
  if (error) {
    throw error;
  }

  console.log(stdout);
  console.log(stderr);
});

elevator.executeSync(command, options) ⇒ String

This function will throw an Error containing a code that equals ELEVATE_CANCELLED if the elevation was cancelled by the user.

Kind: static method of elevator
Summary: Execute a command with UAC elevation (Sync)
Returns: String - stdout buffer
Access: public

ParamTypeDefaultDescription
commandArray.<String>command
optionsObject{}options
options.terminatingBooleanLaunches a terminating command processor; equivalent to "cmd /c command".
options.persistentBooleanLaunches a persistent command processor; equivalent to "cmd /k command".
options.doNotPushdCurrentDirectoryBooleanWhen using -c or -k, do not pushd the current directory before execution.
options.unicodeBooleanWhen using -c or -k, use Unicode; equivalent to "cmd /u".
options.hiddenBooleanWhen using -c or -k, start "cmd" in hidden mode.
options.waitForTerminationBooleanWaits for termination; equivalent to "start /wait command".

Example

elevator.executeSync([ 'cmd.exe' ], {
  waitForTermination: true
});

Support

If you're having any problem, please raise an issue on GitHub and the Resin.io team will be happy to help.

Tests

Run the test suite by doing:

$ gulp test

Contribute

Before submitting a PR, please make sure that you include tests, and that jshint runs without any warning:

$ gulp lint

License

The project is licensed under the MIT license.

2.2.3

7 years ago

2.2.2

7 years ago

2.2.1

7 years ago

2.2.0

7 years ago

2.1.0

8 years ago

2.0.0

8 years ago

1.0.0

8 years ago