{"name":"sudo-prompt","version":"8.2.3","description":"Run a command using sudo, prompting the user with an OS dialog if necessary","main":"index.js","repository":{"type":"git","url":"git+https://github.com/jorangreef/sudo-prompt.git"},"keywords":["sudo","os","dialog","prompt","command","exec","user access control","UAC","privileges","administrative","elevate","run as administrator"],"author":{"name":"Joran Dirk Greef"},"license":"MIT","bugs":{"url":"https://github.com/jorangreef/sudo-prompt/issues"},"homepage":"https://github.com/jorangreef/sudo-prompt#readme","scripts":{},"gitHead":"b07e6a87ca72a5666497f8a26203ea62794ba04d","_id":"sudo-prompt@8.2.3","_npmVersion":"6.4.1","_nodeVersion":"10.8.0","_npmUser":{"name":"jorandirkgreef","email":"joran@ronomon.com"},"dist":{"integrity":"sha512-bjoT7WAPnrKj7CBO9T6DJVqPNC4IB+WxWyIL6zVhq8vJJsTWbUXrFV1qfvaxQRcyLgkSVGN47yNoAYxj+GNwHA==","shasum":"abb34fde78d3458a4f6e84ae1d2a0f603f93e595","tarball":"http://registry-npm.ywwl.com/sudo-prompt/download/sudo-prompt-8.2.3.tgz","fileCount":9,"unpackedSize":319170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbl8SGCRA9TVsSAnZWagAAx8gP/3SbMPXDjDFV8OGo11Ww\nfYbg53U4zpGUlsoMkmLL1LICJEF6B2lPLLnEjUBuqOrFeeA+AKAKOOiPaPH4\ntOEyVJfQlu7o6lxUkkqImKEhszlVdrY7r7Xjr5XxMw3XCemjcTVb6VkdNLTX\nmZ/ygMOBqtUj3xH/v5171ROEDlfkJMTzF+Qbwup432enM8XZZoxrQQy1XeyU\nhN5Ug69ixxGIVmeZ+8pcG2bY2yNZ+Mvx6LsuvwuY4Yisp70l2DLgcSWN96Ah\nPhiLWUsyStw6elsXW/9CEPLEXKNPf7+4EDyuaBceyFpMQ6/LA0TNZQA8ELr1\n3n0JNcwWAdVmii+KpsXmPvF2nMlVKB4DCCYmTlJePWfjBQKSzdsOe9JMseZl\nUnBlr+Wmw01Y3czJ6EIlQJoEBTLNEhBTICZyjtBMUgroU3YT5uhdlRD6d5Io\nSYxJFak6GzZ7jTAdDhIDPQsOI5EapLGtqHfJyald2bwGANYzMdeyIg82ix9q\n//eYdCmdy2VgkhBbpIpMIy2S/4hXOQlNFXx1YoIfCZSU7E0XzlDFKYJYPpts\n37A2G2Pr12bKt3kUJCVx0O0XadO3cMN6YtrktXagpDcbUW303M1/UVfX4bx6\nQsRPan2Y4yy2umy5vzHJJiKpMX0PCm3vdy0K5dMtzCiDV6YyTFB4nIhswSlN\n3ZJz\r\n=39Sv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCj5ARwSwN2YlIOqSslKwSnCcJWJ2+k0CRyX+1hZbWWCwIgXF27ZZNS0FScB/8gmxCdDomQ5TISAv5MTQ2tcVqkub4="}],"size":295776,"noattachment":false,"key":"/sudo-prompt/-/sudo-prompt-8.2.3.tgz"},"maintainers":[{"name":"jorandirkgreef","email":"joran@ronomon.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sudo-prompt_8.2.3_1536672901683_0.3533105371690919"},"_hasShrinkwrap":false,"readme":"# sudo-prompt\n\nRun a non-graphical terminal command using `sudo`, prompting the user with a graphical OS dialog if necessary. Useful for background Node.js applications or native Electron apps that need `sudo`.\n\n## Cross-Platform\n`sudo-prompt` provides a native OS dialog prompt on **macOS**, **Linux** and **Windows**.\n\n![macOS](https://raw.githubusercontent.com/jorangreef/sudo-prompt/master/macos.png)\n\n![Linux](https://raw.githubusercontent.com/jorangreef/sudo-prompt/master/linux.png)\n\n![Windows](https://raw.githubusercontent.com/jorangreef/sudo-prompt/master/windows.png)\n\n## Installation\n`sudo-prompt` has no external dependencies and does not require any native bindings.\n```\nnpm install sudo-prompt\n```\n\n## Usage\nNote: Your command should not start with the `sudo` prefix.\n```javascript\nvar sudo = require('sudo-prompt');\nvar options = {\n  name: 'Electron',\n  icns: '/Applications/Electron.app/Contents/Resources/Electron.icns', // (optional)\n};\nsudo.exec('echo hello', options,\n  function(error, stdout, stderr) {\n    if (error) throw error;\n    console.log('stdout: ' + stdout);\n  }\n);\n```\n\n`sudo-prompt` will use `process.title` as `options.name` if `options.name` is not provided. `options.name` must be alphanumeric only (spaces are supported) and at most 70 characters.\n\n`sudo-prompt` will preserve the current working directory on all platforms. Environment variables can be set explicitly using `options.env`.\n\n**`sudo-prompt.exec()` is different to `child-process.exec()` in that no child process is returned (due to platform and permissions constraints).**\n\n## Behavior\nOn macOS, `sudo-prompt` should behave just like the `sudo` command in the shell. If your command does not work with the `sudo` command in the shell (perhaps because it uses `>` redirection to a restricted file), then it may not work with `sudo-prompt`. However, it is still possible to use sudo-prompt to get a privileged shell, [see this closed issue for more information](https://github.com/jorangreef/sudo-prompt/issues/1).\n\nOn Linux, `sudo-prompt` will use either `pkexec` or `kdesudo` to show the password prompt and run your command. Where possible, `sudo-prompt` will try and get these to mimic `sudo`. Depending on which binary is used, and due to the limitations of some binaries, the name of your program or the command itself may be displayed to your user. `sudo-prompt` will not use `gksudo` since `gksudo` does not support concurrent prompts. Passing `options.icns` is currently not supported by `sudo-prompt` on Linux. Patches are welcome to add support for icons based on `polkit`.\n\nOn Windows, `sudo-prompt` will elevate your command using User Account Control (UAC). Passing `options.name` or `options.icns` is currently not supported by `sudo-prompt` on Windows.\n\n## Non-graphical terminal commands only\nJust as you should never use `sudo` to launch any graphical applications, you should never use `sudo-prompt` to launch any graphical applications. Doing so could cause files in your home directory to become owned by root. `sudo-prompt` is explicitly designed to launch non-graphical terminal commands. For more information, [read this post](http://www.psychocats.net/ubuntu/graphicalsudo).\n\n## Concurrency\nOn systems where the user has opted to have `tty-tickets` enabled (most systems), each call to `exec()` will result in a separate password prompt. Where `tty-tickets` are disabled, subsequent calls to `exec()` will still require a password prompt, even where the user's `sudo` timestamp file remains valid, due to edge cases with `sudo` itself, [see this discussion for more information](https://github.com/jorangreef/sudo-prompt/pull/76).\n\nYou should never rely on `sudo-prompt` to execute your calls in order. If you need to enforce ordering of calls, then you should explicitly order your calls in your application. Where your commands are short-lived, you should always queue your calls to `exec()` to make sure your user is not overloaded with password prompts.\n\n## Invalidating the timestamp\nOn macOS and Linux, you can invalidate the user's `sudo` timestamp file to force the prompt to appear by running the following command in your terminal:\n\n```sh\n$ sudo -k\n```\n","publish_time":1536672901902,"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","_cnpm_publish_time":1536672901902,"dist-tags":{"latest":"9.2.1"}}