Skip to content

Commit

Permalink
stream: compatibility with the --work test
Browse files Browse the repository at this point in the history
  • Loading branch information
mmomtchev committed Dec 2, 2020
1 parent 68f98fb commit 8d0a717
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/parallel/test-fs-promises-file-handle-read-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ const file = path.join(tmpdir.path, 'read_stream_filehandle_worker.txt');
const input = 'hello world';
const { Worker, isMainThread, workerData } = require('worker_threads');

let output = '';

if (isMainThread) {
if (isMainThread || !workerData) {
tmpdir.refresh();
fs.writeFileSync(file, input);

Expand All @@ -33,6 +31,8 @@ if (isMainThread) {
});
});
} else {
let output = '';

const handle = workerData.handle;
handle.on('close', common.mustCall());
const stream = fs.createReadStream(null, { fd: handle });
Expand Down

0 comments on commit 8d0a717

Please sign in to comment.