lune-org/lune

Failed luau to rust type conversions on a few argument cases with `process.spawn`

Closed this issue · 1 comments

Code used:

local success, result = pcall(function()
    local spawnResult = process.spawn("ffmpeg", '--dry-run', 'cmd', "inherit")

end)

print(success, result)

When trying to spawn a process using any value except for nil for the 3rd shell argument, an error like this will be raised:

Failed to convert Luau type 'string' into Rust type 'table'!
[Stack Begin]
    Script '[C]'
    Script 'async', Line 2 - function process.spawn
    Script '../test', Line 9
    Script '[C]' - function pcall
    Script '../test', Line 8 - function convert
    Script '../test', Line 49
    Script '[C]' - function pcall
    Script '../test', Line 42
[Stack End]

This same issue also happens if the 2nd argument is set to an empty string '':

local spawnResult = process.spawn("ffmpeg", '', nil, "inherit")

Error message:

Failed to convert Luau type 'string' into Rust type 'Vec'!
Details:
        expected table
[Stack Begin]
    Script '[C]'
    Script 'async', Line 2 - function process.spawn
    Script '../test', Line 9
    Script '[C]' - function pcall
    Script '../test', Line 8 - function convert
    Script '../test', Line 49
    Script '[C]' - function pcall
    Script '../test', Line 42
[Stack End]

Nevermind. The issue actually stems from me misreading the type annotation of the 2nd argument of process.spawn. Sorry for the wasted time 😅