mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-06 06:41:08 +00:00
test: avoid windows task-owner tempdir hangs
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user