EDIT: After running into a situation where I would like to obtain a commands return code, again, I am restating and reopening this issue.
When I want something more than bash for shell scripting, I much prefer lua + shepi piping implementation over say python + subprocess. The one thing that would make it more complete imo is a way to retrieve the last commands return code in addition to its output.
With popen:
local file = io.popen('rofi -dmenu -kb-custom-1 ctrl+0')
local output = file:read('*all')
-- This will get a table with some return stuff
-- rc[1] will be true, false or nil
-- rc[3] will be the signal
local rc = {file:close()}
print(rc[3])
This answer on stackoverflow uses lua-posix and allows for grabbing the exit status.
Could something similar be implemented with shepi and its different datatypes, command, pipe, fork, fun?
EDIT:
Or exit status of command, pipe, i'm not sure fork, fun are relevant here.
EDIT: After running into a situation where I would like to obtain a commands return code, again, I am restating and reopening this issue.
When I want something more than bash for shell scripting, I much prefer
lua + shepi
piping implementation over saypython + subprocess
. The one thing that would make it more complete imo is a way to retrieve the last commands return code in addition to its output.With popen:
This answer on stackoverflow uses
lua-posix
and allows for grabbing the exit status.Could something similar be implemented with shepi and its different datatypes,
command, pipe, fork, fun
?EDIT:
Or exit status of
command, pipe
, i'm not surefork, fun
are relevant here.