From 95aa277fae99f97c43155406d65c258d82f50a3b Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Sun, 15 Mar 2020 08:47:52 +0000
Subject: [PATCH] Make the write() method more tolerant of a script that is in
 the process of being terminated (e.g. user hitting Ctrl-C in jsexec) - don't
 open and truncate the .cnf file if we're going to exit with an exception
 anyway and likely leave a 0-byte .cnf file behind.

---
 exec/load/cnflib.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/exec/load/cnflib.js b/exec/load/cnflib.js
index 07cca47ba8..5a87612dcb 100644
--- a/exec/load/cnflib.js
+++ b/exec/load/cnflib.js
@@ -231,6 +231,8 @@ var CNF = new (function() {
 					return false;
 			}
 		}
+		if(js.terminated)
+			return false;
 		var f = new File(fullpath(fileName));
 		if(!f.open('wb'))
 			return false;
@@ -242,4 +244,4 @@ var CNF = new (function() {
 
 })();
 
-CNF;
\ No newline at end of file
+CNF;
-- 
GitLab