factorio-init icon indicating copy to clipboard operation
factorio-init copied to clipboard

Code broken when debug enable

Open Beanux opened this issue 1 year ago • 0 comments

An issue only happening by using the debug mode.

Because function return text and that text is used for the code for next step, debug mode break it and add the debug content to the return of the function.

I'm suggestion debug to use error output rather than normal output (normal is catched by your code).

Here is the change:

diff --git a/factorio b/factorio
index 3fb7ad3..b9389d1 100755
--- a/factorio
+++ b/factorio
@@ -12,7 +12,7 @@
 
 function debug() {
   if [ "${DEBUG-0}" -gt 0 ]; then
-    echo "DEBUG: $*"
+    echo "DEBUG: $*" 1>&2
   fi
 }

Original one original_debug

Patched one patched_debug

Beanux avatar Oct 26 '24 13:10 Beanux