js: Allow spawn(command, options) call, fix memory leak

This commit is contained in:
weishu
2024-02-23 09:16:00 +08:00
parent 77d16ac896
commit a829707b16
2 changed files with 9 additions and 1 deletions

View File

@@ -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,

View File

@@ -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": {