mirror of
https://github.com/engineer-man/piston.git
synced 2025-04-22 04:56:30 +02:00
Patch for race condition with filesystem and process cleanup
This commit is contained in:
parent
95421c9e15
commit
9590d5afbc
2 changed files with 57 additions and 3 deletions
|
@ -219,9 +219,14 @@ class Job {
|
|||
|
||||
for (const file of contents) {
|
||||
const file_path = path.join(clean_path, file);
|
||||
const stat = await fs.stat(file_path);
|
||||
if(stat.uid == this.uid)
|
||||
await fs.rm(file_path, { recursive: true, force: true });
|
||||
try{
|
||||
const stat = await fs.stat(file_path);
|
||||
if(stat.uid == this.uid)
|
||||
await fs.rm(file_path, { recursive: true, force: true });
|
||||
}catch(e){
|
||||
// File was somehow deleted in the time that we read the dir to when we checked the file
|
||||
logger.warn(`Error removing file ${file_path}: ${e}`)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue