summaryrefslogtreecommitdiff
path: root/lua/telescope/utils.lua
diff options
context:
space:
mode:
authorSimon Hauser <Simon-Hauser@outlook.de>2021-01-15 09:27:46 +0100
committerGitHub <noreply@github.com>2021-01-15 09:27:46 +0100
commite08a5b13312495fe6534b0c9b89cc0ffe06b7079 (patch)
tree87f56389eb3af4a411ef119d643b84815f4b4acf /lua/telescope/utils.lua
parent57012550977679925176819345adc4d0dce85a00 (diff)
feat: show git log for remote branches (#428)
Diffstat (limited to 'lua/telescope/utils.lua')
-rw-r--r--lua/telescope/utils.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/lua/telescope/utils.lua b/lua/telescope/utils.lua
index e1ef7f3..913c9a2 100644
--- a/lua/telescope/utils.lua
+++ b/lua/telescope/utils.lua
@@ -1,4 +1,5 @@
local pathlib = require('telescope.path')
+local Job = require('plenary.job')
local utils = {}
@@ -193,10 +194,12 @@ function utils.display_termcodes(str)
end
function utils.get_os_command_output(cmd)
- local handle = assert(io.popen(cmd, 'r'))
- local output = assert(handle:read('*a'))
- assert(handle:close())
- return output
+ if type(cmd) ~= "table" then
+ print('Telescope: [get_os_command_output]: cmd has to be a table')
+ return {}
+ end
+ local command = table.remove(cmd, 1)
+ return Job:new({ command = command, args = cmd }):sync()
end
return utils