Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Unable to spawn process

Offen
#647 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
38/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
lua

Rechercherichtung

Start in lua/plenary/job.lua at Job:_execute and inspect how options.cwd is passed to uv.spawn. Reproduce the failure from a Neovim terminal buffer with a term:// cwd, then determine the intended handling for a nonexistent directory; done means process spawning no longer fails for that case without breaking valid working directories.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

I kept seeing an error coming from this library when using my nvim setup. The issue is that special buffers like nvim's terminal report a invalid cwd term:///path/to/file which causes the call to spawn to fail with some error. I have been able to trace down a solution that works for me in the following diff. I doubt this code is acceptable for this project, but I'm sharing since it works for me.

diff --git a/lua/plenary/job.lua b/lua/plenary/job.lua
index 7f54971..4c69e48 100644
--- a/lua/plenary/job.lua
+++ b/lua/plenary/job.lua
@@ -400,7 +400,23 @@ function Job:_execute()
     self:_user_on_start()
   end

-  self.handle, self.pid = uv.spawn(options.command, options, shutdown_factory(self, options))
+  local spawnOptions = {}
+
+  for k, v in pairs(options) do
+    spawnOptions[k] = v
+  end
+
+  if spawnOptions.cwd then
+    local stat = uv.fs_stat(spawnOptions.cwd)
+    if not stat or stat.type ~= "directory" then
+      -- Directory doesn't exist, remove cwd from options
+      spawnOptions.cwd = nil
+    end
+  end
+
+  self.handle, self.pid = uv.spawn(spawnOptions.command, spawnOptions, shutdown_factory(self, spawnOptions))

   if not self.handle then
     error(debug.traceback("Failed to spawn process: " .. vim.inspect(self)))
Vorherrschende Sprache
Lua
Sterne
3.5k
Forks
340
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus nvim-lua/plenary.nvim

Alle Issues in nvim-lua/plenary.nvim

Ähnliche Issues

Weitere Issues zu Lua

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.