Skip to content

Commit

Permalink
move tmpDir cleanup to avoid file locks
Browse files Browse the repository at this point in the history
  • Loading branch information
woolite64 authored and woolite64 committed Nov 17, 2022
1 parent 65551e7 commit 4a7f4ed
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,19 +377,21 @@ async function Editly(config = {}) {
outProcess.stdin.end();
} catch (err) {
outProcess.kill();
if (!keepTmp) await fsExtra.remove(tmpDir);
throw err;
} finally {
if (verbose) console.log('Cleanup');
if (frameSource1) await frameSource1.close();
if (frameSource2) await frameSource2.close();
if (!keepTmp) await fsExtra.remove(tmpDir);
}

try {
if (verbose) console.log('Waiting for output ffmpeg process to finish');
await outProcess;
} catch (err) {
if (outProcessExitCode !== 0 && !err.killed) throw err;
} finally {
if (!keepTmp) await fsExtra.remove(tmpDir);
}

console.log();
Expand Down

0 comments on commit 4a7f4ed

Please sign in to comment.