From b6306031dc97e99ce736eb286720b34eda0ad9d7 Mon Sep 17 00:00:00 2001 From: jake87 Date: Fri, 29 Oct 2021 22:21:46 +1100 Subject: [PATCH] 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. --- packages/ctl/ctl.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/ctl/ctl.js b/packages/ctl/ctl.js index 04d7d568..139dae1a 100755 --- a/packages/ctl/ctl.js +++ b/packages/ctl/ctl.js @@ -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 }); },