Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Job: Output lost if program being run was installed via 'snap'.

Aperta
#672 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
28/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
lua, neovim

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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)
Lingua principale
Lua
Stelle
3.5k
Fork
340
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nvim-lua/plenary.nvim

Tutte le issue di nvim-lua/plenary.nvim

Issue simili

Altre issue su Lua

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.