Skip to content

Commit

Permalink
Catch error on synchrone context
Browse files Browse the repository at this point in the history
  • Loading branch information
martmull committed Aug 23, 2024
1 parent ee457ac commit 2044d11
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import { join } from 'path';
import { tmpdir } from 'os';
import { promises as fs } from 'fs';
Expand Down Expand Up @@ -137,7 +138,7 @@ export class LocalDriver
});
}
child.kill();
fs.unlink(tmpFilePath);
fs.unlink(tmpFilePath).catch(console.error);
});

child.stderr?.on('data', (data) => {
Expand Down Expand Up @@ -169,19 +170,19 @@ export class LocalDriver
},
});
child.kill();
fs.unlink(tmpFilePath);
fs.unlink(tmpFilePath).catch(console.error);
});

child.on('error', (error) => {
reject(error);
child.kill();
fs.unlink(tmpFilePath);
fs.unlink(tmpFilePath).catch(console.error);
});

child.on('exit', (code) => {
if (code && code !== 0) {
reject(new Error(`Child process exited with code ${code}`));
fs.unlink(tmpFilePath);
fs.unlink(tmpFilePath).catch(console.error);
}
});

Expand Down

0 comments on commit 2044d11

Please sign in to comment.