From 5b590b8367776bec24b99599f5c1ee8fd8f9b08c Mon Sep 17 00:00:00 2001 From: blinry Date: Thu, 11 Feb 2021 11:05:33 +0100 Subject: [PATCH] If someone tries to run an editor, use our fake-editor instead --- scenes/shell.gd | 1 - scenes/terminal.gd | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/scenes/shell.gd b/scenes/shell.gd index 31c6d1e..e47e852 100644 --- a/scenes/shell.gd +++ b/scenes/shell.gd @@ -49,7 +49,6 @@ func run_async_thread(shell_command): var env = {} env["HOME"] = game.tmp_prefix env["PATH"] = game.tmp_prefix+":/usr/bin:/bin:/mingw64/bin/" - var hacky_command = "" for variable in env: diff --git a/scenes/terminal.gd b/scenes/terminal.gd index 27c288b..74911ff 100644 --- a/scenes/terminal.gd +++ b/scenes/terminal.gd @@ -80,6 +80,11 @@ func send_command(command): input.editable = false completions.hide() + # If someone tries to run an editor, use fake-editor instead. + var editor_regex = RegEx.new() + editor_regex.compile("^(vim?|gedit|emacs|kate|nano|code) ") + command = editor_regex.sub(command, "fake-editor ") + var cmd = repository.shell.run_async(command, false) yield(cmd, "done") call_deferred("command_done", cmd)