diff options
author | James Ross-Gowan <rossymiles@gmail.com> | 2014-11-18 13:20:59 +1100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-11-18 13:34:00 +0100 |
commit | c6441780982c6d1d4a18f8a33e7e318bf342f1b7 (patch) | |
tree | d657ee10b966010e5f83a1e8ce42ca31bdeac0fa /player | |
parent | 9e77ba8003240f69ac95f0cad16ea0d424c46c18 (diff) | |
download | mpv-c6441780982c6d1d4a18f8a33e7e318bf342f1b7.tar.bz2 mpv-c6441780982c6d1d4a18f8a33e7e318bf342f1b7.tar.xz |
lua: subprocess: support cancellation on Windows
Diffstat (limited to 'player')
-rw-r--r-- | player/lua.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/player/lua.c b/player/lua.c index 552c45badf..699c928e87 100644 --- a/player/lua.c +++ b/player/lua.c @@ -1360,7 +1360,8 @@ static int subprocess(char **args, struct mp_cancel *cancel, void *ctx, *error = NULL; // List of handles to watch with sparse_wait - HANDLE handles[] = { pipes[0].ol.hEvent, pipes[1].ol.hEvent, pi.hProcess }; + HANDLE handles[] = { pipes[0].ol.hEvent, pipes[1].ol.hEvent, pi.hProcess, + cancel ? mp_cancel_get_event(cancel) : NULL }; for (int i = 0; i < 2; i++) { // Close our copy of the write end of the pipes @@ -1404,6 +1405,13 @@ static int subprocess(char **args, struct mp_cancel *cancel, void *ctx, CloseHandle(pi.hProcess); handles[i] = pi.hProcess = NULL; break; + case 3: + if (pi.hProcess) { + TerminateProcess(pi.hProcess, 1); + *error = "killed"; + goto done; + } + break; default: goto done; } |