Skip to content

Commit

Permalink
修复清空文件夹报错
Browse files Browse the repository at this point in the history
  • Loading branch information
whyour committed Oct 13, 2023
1 parent b8a9b26 commit 26b06c1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 2 additions & 2 deletions back/config/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,15 +309,15 @@ export async function emptyDir(path: string) {
return;
}
const files = fs.readdirSync(path);
files.forEach(async (file) => {
for (const file of files) {
const filePath = `${path}/${file}`;
const stats = fs.statSync(filePath);
if (stats.isDirectory()) {
await emptyDir(filePath);
} else {
fs.unlinkSync(filePath);
}
});
}
fs.rmdirSync(path);
}

Expand Down
4 changes: 0 additions & 4 deletions back/loaders/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,9 @@ export default async ({ server }: { server: Server }) => {

process.on('uncaughtException', (error) => {
Logger.error('Uncaught exception:', error);
console.error('Uncaught exception:', error);
process.exit(1);
});

process.on('unhandledRejection', (reason, promise) => {
Logger.error('Unhandled rejection:', reason, promise);
console.error('Unhandled rejection:', reason, promise);
process.exit(1);
});
};

0 comments on commit 26b06c1

Please sign in to comment.