From b90ae91b24a214fb603f90855a3247138e8c9422 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 26 Aug 2020 14:28:10 +0200 Subject: separate supress_output into redirects for stdout and stderr --- spellcheck.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/spellcheck.lua b/spellcheck.lua index 29718aa..6ecaec0 100644 --- a/spellcheck.lua +++ b/spellcheck.lua @@ -3,17 +3,19 @@ local spellcheck = {} spellcheck.lang = os.getenv("LANG"):sub(0,5) or "en_US" -local supress_output = ">/dev/null 2>/dev/null" -if os.execute("type enchant "..supress_output) then +local supress_stdout = " >/dev/null" +local supress_stderr = " 2>/dev/null" +local supress_output = supress_stdout .. supress_stderr +if os.execute("type enchant"..supress_output) then spellcheck.cmd = "enchant -d %s -a" spellcheck.list_cmd = "enchant -l -d %s -a" -elseif os.execute("type enchant-2 "..supress_output) then +elseif os.execute("type enchant-2"..supress_output) then spellcheck.cmd = "enchant-2 -d %s -a" spellcheck.list_cmd = "enchant-2 -l -d %s -a" -elseif os.execute("type aspell "..supress_output) then +elseif os.execute("type aspell"..supress_output) then spellcheck.cmd = "aspell -l %s -a" spellcheck.list_cmd = "aspell list -l %s -a" -elseif os.execute("type hunspell "..supress_output) then +elseif os.execute("type hunspell"..supress_output) then spellcheck.cmd = "hunspell -d %s" spellcheck.list_cmd = "hunspell -l -d %s" else -- cgit v1.2.3