mirror of
https://github.com/fofolee/uTools-ProcessKiller.git
synced 2025-09-28 07:05:04 +08:00
v0.0.2
This commit is contained in:
21
node_modules/powershell/LICENSE
generated
vendored
Normal file
21
node_modules/powershell/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-19 Ionică Bizău <bizauionica@gmail.com> (https://ionicabizau.net)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
143
node_modules/powershell/README.md
generated
vendored
Normal file
143
node_modules/powershell/README.md
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
<!-- Please do not edit this file. Edit the `blah` field in the `package.json` instead. If in doubt, open an issue. -->
|
||||
|
||||
|
||||
# powershell
|
||||
|
||||
[![Support me on Patreon][badge_patreon]][patreon] [![Buy me a book][badge_amazon]][amazon] [![PayPal][badge_paypal_donate]][paypal-donations] [](https://github.com/IonicaBizau/ama) [](https://www.npmjs.com/package/powershell) [](https://www.npmjs.com/package/powershell) [](https://www.codementor.io/johnnyb?utm_source=github&utm_medium=button&utm_term=johnnyb&utm_campaign=github)
|
||||
|
||||
<a href="https://www.buymeacoffee.com/H96WwChMy" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png" alt="Buy Me A Coffee"></a>
|
||||
|
||||
> Run PowerShell scripts and commands from Node.js.
|
||||
|
||||
## Why?
|
||||
|
||||
|
||||
- Actively maintained
|
||||
- Improved codebase.
|
||||
- Written in ES2015
|
||||
|
||||
|
||||
## :cloud: Installation
|
||||
|
||||
```sh
|
||||
# Using npm
|
||||
npm install --save powershell
|
||||
|
||||
# Using yarn
|
||||
yarn add powershell
|
||||
```
|
||||
|
||||
|
||||
## :clipboard: Example
|
||||
|
||||
|
||||
|
||||
```js
|
||||
const PowerShell = require("powershell");
|
||||
|
||||
// Start the process
|
||||
let ps = new PowerShell("echo 'powershell is awesome'");
|
||||
|
||||
// Handle process errors (e.g. powershell not found)
|
||||
ps.on("error", err => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
// Stdout
|
||||
ps.on("output", data => {
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
// Stderr
|
||||
ps.on("error-output", data => {
|
||||
console.error(data);
|
||||
});
|
||||
|
||||
// End
|
||||
ps.on("end", code => {
|
||||
// Do Something on end
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
|
||||
## :question: Get Help
|
||||
|
||||
There are few ways to get help:
|
||||
|
||||
1. Please [post questions on Stack Overflow](https://stackoverflow.com/questions/ask). You can open issues with questions, as long you add a link to your Stack Overflow question.
|
||||
2. For bug reports and feature requests, open issues. :bug:
|
||||
|
||||
3. For direct and quick help, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket:
|
||||
|
||||
|
||||
|
||||
## :memo: Documentation
|
||||
|
||||
|
||||
### `PowerShell(input, opt, cb)`
|
||||
|
||||
#### Params
|
||||
|
||||
- **String** `input`: The command or PowerShell script ro execute.
|
||||
- **Object** `opt`: An object containing the following fields:
|
||||
- `debug` (Boolean): Turn on/off the debug messages (default: `false`).
|
||||
- `noprofile` (Boolean): Turn on/off noprofile parameter (default: `true`).
|
||||
- `executionpolicy` (Enum): Run powershell with specified executionpolicy (default: System default). Valid enum values are `Restricted`, `AllSigned`, `RemoteSigned`, `Unrestricted`, `Bypass`, `Undefined`.
|
||||
- `PSCore` (Boolean) : Turn on/off 'pwsh' the executable for PowerShell Core as opposed to Windowes PowerShell (default: 'false').
|
||||
- **Function** `cb`: The callback function (optional).
|
||||
|
||||
|
||||
|
||||
## :yum: How to contribute
|
||||
Have an idea? Found a bug? See [how to contribute][contributing].
|
||||
|
||||
|
||||
## :sparkling_heart: Support my projects
|
||||
|
||||
I open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously,
|
||||
this takes time. You can integrate and use these projects in your applications *for free*! You can even change the source code and redistribute (even resell it).
|
||||
|
||||
However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:
|
||||
|
||||
|
||||
- Starring and sharing the projects you like :rocket:
|
||||
- [![Buy me a book][badge_amazon]][amazon]—I love books! I will remember you after years if you buy me one. :grin: :book:
|
||||
- [![PayPal][badge_paypal]][paypal-donations]—You can make one-time donations via PayPal. I'll probably buy a ~~coffee~~ tea. :tea:
|
||||
- [![Support me on Patreon][badge_patreon]][patreon]—Set up a recurring monthly donation and you will get interesting news about what I'm doing (things that I don't share with everyone).
|
||||
- **Bitcoin**—You can send me bitcoins at this address (or scanning the code below): `1P9BRsmazNQcuyTxEqveUsnf5CERdq35V6`
|
||||
|
||||

|
||||
|
||||
|
||||
Thanks! :heart:
|
||||
|
||||
|
||||
## :cake: Thanks
|
||||
This module is heavily based on [`node-powershell`](https://github.com/rannn505/node-powershell) by [@rann505](https://github.com/rannn505/).
|
||||
|
||||
## :dizzy: Where is this library used?
|
||||
If you are using this library in one of your projects, add it in this list. :sparkles:
|
||||
|
||||
|
||||
- [`workflow-wm-windows`](https://github.com/havardh/workflow/tree/master/packages/workflow-wm-windows#readme) (by Håvard Wormdal Høiby)—Windows window manager adapter for workflow
|
||||
- [`workflow-wm-windows-python`](https://github.com/havardh/workflow/tree/master/packages/workflow-wm-windows-python#readme) (by Håvard Wormdal Høiby)—Windows window manager adapter for workflow using python
|
||||
|
||||
## :scroll: License
|
||||
|
||||
[MIT][license] © [Ionică Bizău][website]
|
||||
|
||||
|
||||
[badge_patreon]: https://ionicabizau.github.io/badges/patreon.svg
|
||||
[badge_amazon]: https://ionicabizau.github.io/badges/amazon.svg
|
||||
[badge_paypal]: https://ionicabizau.github.io/badges/paypal.svg
|
||||
[badge_paypal_donate]: https://ionicabizau.github.io/badges/paypal_donate.svg
|
||||
|
||||
[patreon]: https://www.patreon.com/ionicabizau
|
||||
[amazon]: http://amzn.eu/hRo9sIZ
|
||||
[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RVXDDLKKLQRJW
|
||||
|
||||
[license]: http://showalicense.com/?fullname=Ionic%C4%83%20Biz%C4%83u%20%3Cbizauionica%40gmail.com%3E%20(https%3A%2F%2Fionicabizau.net)&year=2015#license-mit
|
||||
[website]: https://ionicabizau.net
|
||||
[contributing]: /CONTRIBUTING.md
|
||||
[docs]: /DOCUMENTATION.md
|
97
node_modules/powershell/lib/index.js
generated
vendored
Normal file
97
node_modules/powershell/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
"use strict";
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var isUndefined = require("is-undefined"),
|
||||
EventEmitter = require("events").EventEmitter,
|
||||
spawn = require("spawno"),
|
||||
isWin = require("is-win");
|
||||
|
||||
module.exports = function (_EventEmitter) {
|
||||
_inherits(PowerShell, _EventEmitter);
|
||||
|
||||
/**
|
||||
* PowerShell
|
||||
*
|
||||
* @name PowerShell
|
||||
* @function
|
||||
* @param {String} input The command or PowerShell script ro execute.
|
||||
* @param {Object} opt An object containing the following fields:
|
||||
*
|
||||
* - `debug` (Boolean): Turn on/off the debug messages (default: `false`).
|
||||
* - `noprofile` (Boolean): Turn on/off noprofile parameter (default: `true`).
|
||||
* - `executionpolicy` (Enum): Run powershell with specified executionpolicy (default: System default). Valid enum values are `Restricted`, `AllSigned`, `RemoteSigned`, `Unrestricted`, `Bypass`, `Undefined`.
|
||||
* - `PSCore` (Boolean) : Turn on/off 'pwsh' the executable for PowerShell Core as opposed to Windowes PowerShell (default: 'false').
|
||||
*
|
||||
* @param {Function} cb The callback function (optional).
|
||||
*/
|
||||
function PowerShell(input, opt, cb) {
|
||||
_classCallCheck(this, PowerShell);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (PowerShell.__proto__ || Object.getPrototypeOf(PowerShell)).call(this));
|
||||
|
||||
opt = opt || {};
|
||||
opt.debug = isUndefined(opt.debug) ? false : opt.debug;
|
||||
opt.noprofile = isUndefined(opt.noprofile) ? true : opt.noprofile;
|
||||
opt.PSCore = isUndefined(opt.PSCore) ? false : opt.PSCore;
|
||||
var EXE_NAME = "" + (opt.PSCore ? 'pwsh' : 'powershell') + (isWin() ? ".exe" : "");
|
||||
var args = [];
|
||||
|
||||
if (opt.noprofile) {
|
||||
args.push("-NoProfile");
|
||||
}
|
||||
|
||||
if (!isUndefined(opt.executionpolicy)) {
|
||||
args.push("-ExecutionPolicy", opt.executionpolicy);
|
||||
}
|
||||
|
||||
args.push("-Command", "& {" + input + "}");
|
||||
|
||||
var _proc = _this.proc = spawn(EXE_NAME, args, { stdio: ["ignore", "pipe", "pipe"] }, cb);
|
||||
|
||||
_proc.stdout.setEncoding("utf8");
|
||||
_proc.stderr.setEncoding("utf8");
|
||||
_proc.on("error", function (err) {
|
||||
return _this.emit("error", err);
|
||||
});
|
||||
|
||||
if (opt.debug) {
|
||||
console.log("<" + EXE_NAME + "> Starting " + _proc.pid + " on " + process.platform);
|
||||
}
|
||||
|
||||
var chunks = [];
|
||||
|
||||
_proc.stdout.on("data", function (chunk) {
|
||||
if (typeof chunk === "string") {
|
||||
chunks.push(chunk);
|
||||
} else {
|
||||
chunks.push.apply(chunks, chunk);
|
||||
}
|
||||
});
|
||||
|
||||
var err_chunks = [];
|
||||
|
||||
_proc.stderr.on("data", function (err_chunk) {
|
||||
if (typeof err_chunk === "string") {
|
||||
err_chunks.push(err_chunk);
|
||||
} else {
|
||||
err_chunks.push.apply(err_chunks, err_chunk);
|
||||
}
|
||||
});
|
||||
_proc.on("close", function (code) {
|
||||
if (opt.debug) {
|
||||
console.log("<" + EXE_NAME + "> Process " + _proc.pid + " exited with code " + code);
|
||||
}
|
||||
_this.emit("output", chunks.join(""));
|
||||
_this.emit("error-output", err_chunks.join(""))
|
||||
_this.emit("end", code);
|
||||
});
|
||||
return _this;
|
||||
}
|
||||
|
||||
return PowerShell;
|
||||
}(EventEmitter);
|
92
node_modules/powershell/package.json
generated
vendored
Normal file
92
node_modules/powershell/package.json
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"_from": "powershell",
|
||||
"_id": "powershell@2.3.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-unE7o0yo3mIL5vk2T44tZgGwznUYHVwyeLDa95qf5QPRbtp0Ol9xAGJje1GVHt1vgf7w28O+7MsDM5JbIDxsfg==",
|
||||
"_location": "/powershell",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "powershell",
|
||||
"name": "powershell",
|
||||
"escapedName": "powershell",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/powershell/-/powershell-2.3.1.tgz",
|
||||
"_shasum": "267ab1752a31f49cb11322119a1bf163f85303b6",
|
||||
"_spec": "powershell",
|
||||
"_where": "C:\\Users\\fofol\\OneDrive\\Configs\\ProcessKiller",
|
||||
"author": {
|
||||
"name": "Ionică Bizău",
|
||||
"email": "bizauionica@gmail.com",
|
||||
"url": "https://ionicabizau.net"
|
||||
},
|
||||
"blah": {
|
||||
"description": [
|
||||
{
|
||||
"h2": "Why?"
|
||||
},
|
||||
{
|
||||
"ul": [
|
||||
"Actively maintained",
|
||||
"Improved codebase.",
|
||||
"Written in ES2015"
|
||||
]
|
||||
}
|
||||
],
|
||||
"thanks": "This module is heavily based on [`node-powershell`](https://github.com/rannn505/node-powershell) by [@rann505](https://github.com/rannn505/)."
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/IonicaBizau/powershell/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"is-undefined": "^1.0.0",
|
||||
"is-win": "^1.0.2",
|
||||
"spawno": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Run PowerShell scripts and commands from Node.js.",
|
||||
"directories": {
|
||||
"example": "example"
|
||||
},
|
||||
"files": [
|
||||
"bin/",
|
||||
"app/",
|
||||
"lib/",
|
||||
"dist/",
|
||||
"src/",
|
||||
"scripts/",
|
||||
"resources/",
|
||||
"menu/",
|
||||
"cli.js",
|
||||
"index.js",
|
||||
"bloggify.js",
|
||||
"bloggify.json",
|
||||
"bloggify/"
|
||||
],
|
||||
"homepage": "https://github.com/IonicaBizau/powershell#readme",
|
||||
"keywords": [
|
||||
"powershell",
|
||||
"commands",
|
||||
"scripts"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "powershell",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/IonicaBizau/powershell.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"version": "2.3.1"
|
||||
}
|
Reference in New Issue
Block a user