Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Unable to spawn process

Đang mở
#647 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
38/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
lua
Lĩnh vực
operating-systems

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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)))
Ngôn ngữ chính
Lua
Star
3.5k
Fork
341
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của nvim-lua/plenary.nvim

Tất cả issue của nvim-lua/plenary.nvim

Issue tương tự

Thêm issue về Lua

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.