Skip to content

Commit f110c20

Browse files
committed
Join the process server after running all compile tests
1 parent 067cb6d commit f110c20

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/test/compiletest/compiletest.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,8 @@ mod procsrv {
525525
export run;
526526
export close;
527527

528-
type handle = chan[request];
528+
type handle = rec(option::t[task] task,
529+
chan[request] chan);
529530

530531
tag request {
531532
exec(str, str, vec[str], chan[response]);
@@ -535,22 +536,28 @@ mod procsrv {
535536
type response = rec(int pid, int outfd);
536537

537538
fn mk() -> handle {
538-
task::worker(worker).chan
539+
auto res = task::worker(worker);
540+
ret rec(task = option::some(res.task),
541+
chan = res.chan);
539542
}
540543

541544
fn clone(&handle handle) -> handle {
542-
task::clone_chan(handle)
545+
// Sharing tasks across tasks appears to be (yet another) recipe for
546+
// disaster, so our handle clones will not get the task pointer.
547+
rec(task = option::none,
548+
chan = task::clone_chan(handle.chan))
543549
}
544550

545551
fn close(&handle handle) {
546-
task::send(handle, stop);
552+
task::send(handle.chan, stop);
553+
task::join(option::get(handle.task));
547554
}
548555

549556
fn run(&handle handle, &str lib_path,
550557
&str prog, &vec[str] args) -> rec(int status, str out) {
551558
auto p = port[response]();
552559
auto ch = chan(p);
553-
task::send(handle,
560+
task::send(handle.chan,
554561
exec(lib_path, prog, args, ch));
555562

556563
auto resp = task::recv(p);

0 commit comments

Comments
 (0)