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