mirror of https://github.com/openclaw/openclaw.git
test: avoid windows task-owner tempdir hangs
This commit is contained in:
parent
1849cf71c2
commit
9e47c1a2c5
|
|
@ -21,9 +21,19 @@ afterEach(() => {
|
|||
|
||||
async function withTaskRegistryTempDir<T>(run: () => Promise<T> | T): Promise<T> {
|
||||
return await withTempDir({ prefix: "openclaw-task-owner-access-" }, async (root) => {
|
||||
const previousStateDir = process.env.OPENCLAW_STATE_DIR;
|
||||
process.env.OPENCLAW_STATE_DIR = root;
|
||||
resetTaskRegistryForTests({ persist: false });
|
||||
return await run();
|
||||
try {
|
||||
return await run();
|
||||
} finally {
|
||||
resetTaskRegistryForTests({ persist: false });
|
||||
if (previousStateDir == null) {
|
||||
delete process.env.OPENCLAW_STATE_DIR;
|
||||
} else {
|
||||
process.env.OPENCLAW_STATE_DIR = previousStateDir;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue