From f110c206097e9483cbe68be50eca80ac63abcbbd Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 25 Jul 2011 23:18:31 -0700 Subject: [PATCH] Join the process server after running all compile tests --- src/test/compiletest/compiletest.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/test/compiletest/compiletest.rs b/src/test/compiletest/compiletest.rs index 2f3c6a6f953a..2bca022eeb4f 100644 --- a/src/test/compiletest/compiletest.rs +++ b/src/test/compiletest/compiletest.rs @@ -525,7 +525,8 @@ mod procsrv { export run; export close; - type handle = chan[request]; + type handle = rec(option::t[task] task, + chan[request] chan); tag request { exec(str, str, vec[str], chan[response]); @@ -535,22 +536,28 @@ mod procsrv { type response = rec(int pid, int outfd); fn mk() -> handle { - task::worker(worker).chan + auto res = task::worker(worker); + ret rec(task = option::some(res.task), + chan = res.chan); } fn clone(&handle handle) -> handle { - task::clone_chan(handle) + // Sharing tasks across tasks appears to be (yet another) recipe for + // disaster, so our handle clones will not get the task pointer. + rec(task = option::none, + chan = task::clone_chan(handle.chan)) } fn close(&handle handle) { - task::send(handle, stop); + task::send(handle.chan, stop); + task::join(option::get(handle.task)); } fn run(&handle handle, &str lib_path, &str prog, &vec[str] args) -> rec(int status, str out) { auto p = port[response](); auto ch = chan(p); - task::send(handle, + task::send(handle.chan, exec(lib_path, prog, args, ch)); auto resp = task::recv(p);