зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1295867: Wait for all IO operations to complete before ending test tasks. r=aswan
MozReview-Commit-ID: A6DIpXE5M1R --HG-- extra : rebase_source : 386f3e602a169ad105dc4bf9abe74c4c6ffe10c2
This commit is contained in:
Родитель
2c634c4cb0
Коммит
5f2a25f86e
|
@ -61,6 +61,19 @@ class BaseProcess {
|
|||
this.spawn(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for the process to exit and all of its pending IO operations to
|
||||
* complete.
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
awaitFinished() {
|
||||
return Promise.all([
|
||||
this.exitPromise,
|
||||
...this.pipes.map(pipe => pipe.closedPromise),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a null-terminated array of pointers to null-terminated C-strings,
|
||||
* and returns it.
|
||||
|
@ -130,8 +143,11 @@ let requests = {
|
|||
|
||||
process.wait();
|
||||
|
||||
return process.exitPromise.then(exitCode => {
|
||||
process.awaitFinished().then(() => {
|
||||
io.cleanupProcess(process);
|
||||
});
|
||||
|
||||
return process.exitPromise.then(exitCode => {
|
||||
return {data: {exitCode}};
|
||||
});
|
||||
},
|
||||
|
@ -163,7 +179,8 @@ let requests = {
|
|||
},
|
||||
|
||||
waitForNoProcesses() {
|
||||
return Promise.all(Array.from(io.processes.values(), proc => proc.exitPromise));
|
||||
return Promise.all(Array.from(io.processes.values(),
|
||||
proc => proc.awaitFinished()));
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче