diff --git a/js/index.js b/js/index.js index a7a7422c..7d547425 100644 --- a/js/index.js +++ b/js/index.js @@ -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, diff --git a/js/package.json b/js/package.json index f5fce642..8fb1650a 100644 --- a/js/package.json +++ b/js/package.json @@ -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": {