fix(process): make sure cwd is a valid directory

This commit is contained in:
Folke Lemaitre 2023-10-10 11:52:45 +02:00
parent 736529d097
commit 92869d0928
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 5 additions and 0 deletions

View File

@ -90,6 +90,11 @@ function M.spawn(cmd, opts)
end) end)
end end
-- make sure the cwd is valid
if not opts.cwd and type(uv.cwd()) ~= "string" then
opts.cwd = uv.os_homedir()
end
handle = uv.spawn(cmd, { handle = uv.spawn(cmd, {
stdio = { nil, stdout, stderr }, stdio = { nil, stdout, stderr },
args = opts.args, args = opts.args,