Job: Output lost if program being run was installed via 'snap'.
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 28/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- lua, neovim
- Domain
- operating-systems, tooling
Research direction
Start at the plenary.job entry points shown in the reproduction: new(), start(), and result(). Reproduce on Linux with jq installed via apt and yq via snap, then inspect how process output is captured for commands whose standard descriptors are sockets. Done means output from snap-installed programs is returned like output from the apt-installed command.
Written by the indexing model from the issue text.
Description
This was a weird one to try and debug, reproduction requires a Linux system with snap installed, which likely means some Debian derived distribution.
To most easily reproduce, install jq via apt, and yq via snap, save the following as something like /tmp/snap_output_lost.lua, and in neovim run something like :=luafile /tmp/snap_output_lost.lua:
local ok, j = pcall(function()
return require("plenary.job"):new({
command = "jq",
args = { "--version" },
on_exit = vim.schedule_wrap(function(j, code)
vim.notify("jq j.result: " .. vim.inspect(j:result()))
end),
})
end)
vim.notify("jq ok: " .. vim.inspect(ok))
local spawn_ok, err = pcall(j.start, j)
vim.notify("jq spawn_ok: " .. vim.inspect(spawn_ok) .. ", err: " .. vim.inspect(err))
local ok, j = pcall(function()
return require("plenary.job"):new({
command = "yq",
args = { "--version" },
on_exit = vim.schedule_wrap(function(j, code)
vim.notify("yq j.result: " .. vim.inspect(j:result()))
end),
})
end)
vim.notify("yq ok: " .. vim.inspect(ok))
local spawn_ok, err = pcall(j.start, j)
vim.notify("yq spawn_ok: " .. vim.inspect(spawn_ok) .. ", err: " .. vim.inspect(err))
On my system, the output from jq is printed, and the output from yq is lost.
Which leads to the next question: Why?
(This took a bit to figure out.)
If you run some long running program installed via snap, launch it with the above, and look at /proc/<pid>/fd/[012], you'll find that they are all sockets.
I'm not yet sure why that matters, but a script that redirects everything to force stdout and stderr to be pipes instead of sockets seems to work for me:
#!/bin/bash
yq "$@" > >(cat) 2> >(cat >&2)
- Dominant language
- Lua
- Stars
- 3.5k
- Forks
- 340
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nvim-lua/plenary.nvim
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
nvim-lua/plenary.nvim#682 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
nvim-lua/plenary.nvim#680 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
nvim-lua/plenary.nvim#675 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
nvim-lua/plenary.nvim#671 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
nvim-lua/plenary.nvim#670 ·
All issues in nvim-lua/plenary.nvim
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
LandSandBoat/server#11579 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
ArchiveTeam/sinavideo-grab#7 · 3 reactions ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
mailcow/mailcow-dockerized#7480 ·
-
mapper bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100