Also somewhat cleans up mp.command_native_async() error handling.
Showing the changes to TOOLS/lua/command-test.lua (1 of 4 files). Show all
Unified · Split
| @@ -55,4 +55,13 @@ mp.observe_property("vo-configured", "bool", function(_, v) · 54 unmodified lines | ||
| 55 | 55 | function(res, val, err) |
| 56 | 56 | print("done subprocess: " .. join(" ", {res, val, err})) |
| 57 | 57 | end) |
| 58 | + | |
| 59 | + local x = mp.command_native_async({name = "subprocess", args = {"sleep", "inf"}}, | |
| 60 | + function(res, val, err) | |
| 61 | + print("done sleep inf subprocess: " .. join(" ", {res, val, err})) | |
| 62 | + end) | |
| 63 | + mp.add_timeout(15, function() | |
| 64 | + print("aborting sleep inf subprocess after timeout") | |
| 65 | + mp.abort_async_command(x) | |
| 66 | + end) | |
| 58 | 67 | end) |