js: Allow spawn(command, options) call, fix memory leak
This commit is contained in:
@@ -71,6 +71,9 @@ function Stdio() {
|
||||
export function spawn(command, args, options) {
|
||||
if (typeof args === "undefined") {
|
||||
args = [];
|
||||
} else if (typeof args === "object") {
|
||||
// allow for (command, options) signature
|
||||
options = args;
|
||||
}
|
||||
|
||||
if (typeof options === "undefined") {
|
||||
@@ -84,6 +87,11 @@ function Stdio() {
|
||||
function cleanup(name) {
|
||||
delete window[name];
|
||||
}
|
||||
|
||||
child.on("exit", code => {
|
||||
cleanup(childCallbackName);
|
||||
});
|
||||
|
||||
try {
|
||||
ksu.spawn(
|
||||
command,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "kernelsu",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.5",
|
||||
"description": "Library for KernelSU's module WebUI",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user