aboutsummaryrefslogtreecommitdiffstats
path: root/spellcheck.lua
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2020-08-26 14:28:10 +0200
committerFlorian Fischer <florian.fl.fischer@fau.de>2020-08-26 14:28:10 +0200
commitb90ae91b24a214fb603f90855a3247138e8c9422 (patch)
tree95b39a3c10638e7b98fe7943329f794592e9f422 /spellcheck.lua
parent8093caf55ba0df77fe297f682c2a327fba8ccb28 (diff)
downloadvis-spellcheck-b90ae91b24a214fb603f90855a3247138e8c9422.tar.gz
separate supress_output into redirects for stdout and stderr
Diffstat (limited to 'spellcheck.lua')
-rw-r--r--spellcheck.lua12
1 files 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