Skip to content

Commit 8d0a717

Browse files
committed
stream: compatibility with the --work test
1 parent 68f98fb commit 8d0a717

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/parallel/test-fs-promises-file-handle-read-worker.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ const file = path.join(tmpdir.path, 'read_stream_filehandle_worker.txt');
88
const input = 'hello world';
99
const { Worker, isMainThread, workerData } = require('worker_threads');
1010

11-
let output = '';
12-
13-
if (isMainThread) {
11+
if (isMainThread || !workerData) {
1412
tmpdir.refresh();
1513
fs.writeFileSync(file, input);
1614

@@ -33,6 +31,8 @@ if (isMainThread) {
3331
});
3432
});
3533
} else {
34+
let output = '';
35+
3636
const handle = workerData.handle;
3737
handle.on('close', common.mustCall());
3838
const stream = fs.createReadStream(null, { fd: handle });

0 commit comments

Comments
 (0)