Skip to content

Commit

Permalink
fix: use fs writeSync instead of stream for injected script
Browse files Browse the repository at this point in the history
This prevents EBADF exception on macOS
  • Loading branch information
JackuB committed Apr 19, 2021
1 parent 975007a commit a49acd7
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/index.ts
Expand Up @@ -398,9 +398,7 @@ async function getInjectedScriptPath(): Promise<{
// Copying the injectable script into a temp file.
try {
const tmpInitGradle = tmp.fileSync({ postfix: '-init.gradle' });
fs.createReadStream(initGradleAsset).pipe(
fs.createWriteStream('', { fd: tmpInitGradle!.fd }),
);
fs.writeSync(tmpInitGradle.fd, fs.readFileSync(initGradleAsset));
return {
injectedScripPath: tmpInitGradle.name,
cleanupCallback: tmpInitGradle.removeCallback,
Expand Down

0 comments on commit a49acd7

Please sign in to comment.