Reworked some of editor logic to work with async functions

Now async functions can be used after the editor returns, as before they
couldnt be used due to .on being non-async.
This commit is contained in:
jake87 committed 2021-10-29 22:21:46 +11:00
1 parent 0564eee400
commit b6306031dc
1 file changed
+4 -3
+4 -3
View File
@@ -132,6 +132,9 @@ masterConfigCommands.add(new libCommand.Command({
exit(1); // TODO: exit gracefully apon no editor
}
async function afterEditorDone() {
print("editordone");
}
// <-- start process of running editor -->
let editorSpawn = child_process.spawn(editor, [tmpFile], {
@@ -149,9 +152,7 @@ masterConfigCommands.add(new libCommand.Command({
editorSpawn.on("exit", (exit) => {
let masterConfig = new libConfig.MasterConfig("control");
// eslint-disable-next-line
masterConfig.load(response);
afterEditorDone();
// from here is when the edit exits, i.e. the user has quit
});
},