summaryrefslogtreecommitdiffstats
path: root/player/lua.c
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossymiles@gmail.com>2014-11-18 13:20:59 +1100
committerwm4 <wm4@nowhere>2014-11-18 13:34:00 +0100
commitc6441780982c6d1d4a18f8a33e7e318bf342f1b7 (patch)
treed657ee10b966010e5f83a1e8ce42ca31bdeac0fa /player/lua.c
parent9e77ba8003240f69ac95f0cad16ea0d424c46c18 (diff)
downloadmpv-c6441780982c6d1d4a18f8a33e7e318bf342f1b7.tar.bz2
mpv-c6441780982c6d1d4a18f8a33e7e318bf342f1b7.tar.xz
lua: subprocess: support cancellation on Windows
Diffstat (limited to 'player/lua.c')
-rw-r--r--player/lua.c10
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;
}