{"_id":"@vscode/sudo-prompt","_rev":"4402324","name":"@vscode/sudo-prompt","description":"Run a command using sudo, prompting the user with an OS dialog if necessary","dist-tags":{"latest":"9.3.2"},"maintainers":[{"name":"alexandrudima","email":""},{"name":"joaomoreno.ms","email":""},{"name":"kaimaetzel","email":"kamaet@microsoft.com"},{"name":"lszomoru","email":""},{"name":"microsoft1es","email":""},{"name":"rebornix","email":"penn.lv@gmail.com"},{"name":"sbatten","email":"steven.m.batten@outlook.com"},{"name":"vscode-bot","email":""}],"time":{"modified":"2026-04-08T12:16:52.000Z","created":"2021-11-17T11:54:37.030Z","9.3.2":"2026-01-08T15:28:17.790Z","9.3.1":"2021-11-19T18:53:16.624Z","9.3.0":"2021-11-17T11:54:37.030Z"},"users":{},"author":{"name":"Joran Dirk Greef"},"repository":{"type":"git","url":"git+https://github.com/microsoft/vscode-sudo-prompt.git"},"versions":{"9.3.2":{"name":"@vscode/sudo-prompt","version":"9.3.2","description":"Run a command using sudo, prompting the user with an OS dialog if necessary","main":"index.js","types":"index.d.ts","repository":{"type":"git","url":"git+https://github.com/microsoft/vscode-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/microsoft/vscode-sudo-prompt/issues"},"homepage":"https://github.com/microsoft/vscode-sudo-prompt#readme","scripts":{},"_id":"@vscode/sudo-prompt@9.3.2","_integrity":"sha512-gcXoCN00METUNFeQOFJ+C9xUI0DKB+0EGMVg7wbVYRHBw2Eq3fKisDZOkRdOz3kqXRKOENMfShPOmypw1/8nOw==","_resolved":"M:\\SvcFab\\_App\\MS.Ess.PackageManager.Publisher_App2\\temp\\e148631c-b928-4a0c-a700-8eb067f44286\\vscode-sudo-prompt-9.3.2.tgz","_from":"file:M:\\SvcFab\\_App\\MS.Ess.PackageManager.Publisher_App2\\temp\\e148631c-b928-4a0c-a700-8eb067f44286\\vscode-sudo-prompt-9.3.2.tgz","tag":"latest","_nodeVersion":"18.5.0","dist":{"shasum":"692ba38df40bd3502ccc4e9f099fbbaedbd5f04e","size":17306,"noattachment":false,"key":"/@vscode/sudo-prompt/-/@vscode/sudo-prompt-9.3.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/@vscode/sudo-prompt/download/@vscode/sudo-prompt-9.3.2.tgz"},"_npmUser":{"name":"microsoft1es","email":"npmjs@microsoft.com"},"directories":{},"maintainers":[{"name":"alexandrudima","email":""},{"name":"joaomoreno.ms","email":""},{"name":"kaimaetzel","email":"kamaet@microsoft.com"},{"name":"lszomoru","email":""},{"name":"microsoft1es","email":""},{"name":"rebornix","email":"penn.lv@gmail.com"},{"name":"sbatten","email":"steven.m.batten@outlook.com"},{"name":"vscode-bot","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sudo-prompt_9.3.2_1767886097658_0.6659383890039119"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2026-01-08T15:28:17.790Z","publish_time":1767886097790,"_source_registry_name":"default","_cnpm_publish_time":1767886097790},"9.3.1":{"name":"@vscode/sudo-prompt","version":"9.3.1","description":"Run a command using sudo, prompting the user with an OS dialog if necessary","main":"index.js","types":"index.d.ts","repository":{"type":"git","url":"git+https://github.com/bpasero/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/bpasero/sudo-prompt/issues"},"homepage":"https://github.com/bpasero/sudo-prompt#readme","scripts":{},"gitHead":"9b0a927f93b8fdd063fa7ad0e895c1e6d35e61ce","_id":"@vscode/sudo-prompt@9.3.1","_nodeVersion":"16.0.0","_npmVersion":"7.10.0","dist":{"shasum":"c562334bc6647733649fd42afc96c0eea8de3b65","size":18123,"noattachment":false,"key":"/@vscode/sudo-prompt/-/@vscode/sudo-prompt-9.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@vscode/sudo-prompt/download/@vscode/sudo-prompt-9.3.1.tgz"},"_npmUser":{"name":"bpasero","email":"benjpas@microsoft.com"},"directories":{},"maintainers":[{"name":"alexandrudima","email":""},{"name":"joaomoreno.ms","email":""},{"name":"kaimaetzel","email":"kamaet@microsoft.com"},{"name":"lszomoru","email":""},{"name":"microsoft1es","email":""},{"name":"rebornix","email":"penn.lv@gmail.com"},{"name":"sbatten","email":"steven.m.batten@outlook.com"},{"name":"vscode-bot","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sudo-prompt_9.3.1_1637347996494_0.15431836897619977"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-28T00:46:00.283Z","publish_time":1637347996624,"_cnpm_publish_time":1637347996624},"9.3.0":{"name":"@vscode/sudo-prompt","version":"9.3.0","description":"Run a command using sudo, prompting the user with an OS dialog if necessary","main":"index.js","types":"index.d.ts","repository":{"type":"git","url":"git+https://github.com/microsoft/vscode-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/microsoft/vscode-sudo-prompt/issues"},"homepage":"https://github.com/microsoft/vscode-sudo-prompt#readme","scripts":{},"gitHead":"212514f131c27b3ee90e1ffe731a62e72ee3a92d","_id":"@vscode/sudo-prompt@9.3.0","_nodeVersion":"16.0.0","_npmVersion":"7.10.0","dist":{"shasum":"5c63b195986d1d6a142856146e51c6b46a3319b2","size":18112,"noattachment":false,"key":"/@vscode/sudo-prompt/-/@vscode/sudo-prompt-9.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@vscode/sudo-prompt/download/@vscode/sudo-prompt-9.3.0.tgz"},"_npmUser":{"name":"bpasero","email":"benjpas@microsoft.com"},"directories":{},"maintainers":[{"name":"alexandrudima","email":""},{"name":"joaomoreno.ms","email":""},{"name":"kaimaetzel","email":"kamaet@microsoft.com"},{"name":"lszomoru","email":""},{"name":"microsoft1es","email":""},{"name":"rebornix","email":"penn.lv@gmail.com"},{"name":"sbatten","email":"steven.m.batten@outlook.com"},{"name":"vscode-bot","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sudo-prompt_9.3.0_1637150076875_0.6383373584086691"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-28T00:45:58.753Z","publish_time":1637150077030,"_cnpm_publish_time":1637150077030}},"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**Note:** the origin of this work is at https://github.com/jorangreef/sudo-prompt and has been moved to https://github.com/microsoft/vscode-sudo-prompt for maintenance and use in VS Code as that original repository is archived by now.\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('@vscode/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","_attachments":{},"homepage":"https://github.com/microsoft/vscode-sudo-prompt#readme","bugs":{"url":"https://github.com/microsoft/vscode-sudo-prompt/issues"},"license":"MIT"}