Skip to content

Commit

Permalink
fix: check run dir exists before read it (#33)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
	- Introduced a simplified existence check for the `rundir` directory.
  
- **Chores**
- Updated the `utility` dependency version in the project configuration.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
fengmk2 authored Dec 22, 2024
1 parent fac5ba2 commit d95db72
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ const path = require('node:path');
const fs = require('node:fs/promises');
const debounce = require('debounce');
const multimatch = require('multimatch');
const { exists } = require('utility');

module.exports = agent => {
// clean all timing json
agent.beforeStart(async () => {
const rundir = agent.config.rundir;
const stat = await fs.stat(rundir, { throwIfNoEntry: false });
const stat = await exists(rundir);
if (!stat) return;
const files = await fs.readdir(rundir);
for (const file of files) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"dependencies": {
"debounce": "^1.1.0",
"multimatch": "^5.0.0",
"utility": "^2.3.0"
"utility": "^2.4.0"
},
"devDependencies": {
"@types/node": "^22.10.2",
Expand Down

0 comments on commit d95db72

Please sign in to comment.