| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -162,8 +162,9 @@ port.on('message', (message) => { | |||
| 162 | 162 | CJSLoader.Module.runMain(filename); | |
| 163 | 163 | } | |
| 164 | 164 | } else if (message.type === STDIO_PAYLOAD) { | |
| 165 | - const { stream, chunk, encoding } = message; | ||
| 166 | - process[stream].push(chunk, encoding); | ||
| 165 | + const { stream, chunks } = message; | ||
| 166 | + for (const { chunk, encoding } of chunks) | ||
| 167 | + process[stream].push(chunk, encoding); | ||
| 167 | 168 | } else { | |
| 168 | 169 | assert( | |
| 169 | 170 | message.type === STDIO_WANTS_MORE_DATA, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -242,8 +242,11 @@ class Worker extends EventEmitter { | |||
| 242 | 242 | return this[kOnErrorMessage](message.error); | |
| 243 | 243 | case messageTypes.STDIO_PAYLOAD: | |
| 244 | 244 | { | |
| 245 | - const { stream, chunk, encoding } = message; | ||
| 246 | - return this[kParentSideStdio][stream].push(chunk, encoding); | ||
| 245 | + const { stream, chunks } = message; | ||
| 246 | + const readable = this[kParentSideStdio][stream]; | ||
| 247 | + for (const { chunk, encoding } of chunks) | ||
| 248 | + readable.push(chunk, encoding); | ||
| 249 | + return; | ||
| 247 | 250 | } | |
| 248 | 251 | case messageTypes.STDIO_WANTS_MORE_DATA: | |
| 249 | 252 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -206,12 +206,11 @@ class WritableWorkerStdio extends Writable { | |||
| 206 | 206 | this[kWritableCallbacks] = []; | |
| 207 | 207 | } | |
| 208 | 208 | ||
| 209 | - _write(chunk, encoding, cb) { | ||
| 209 | + _writev(chunks, cb) { | ||
| 210 | 210 | this[kPort].postMessage({ | |
| 211 | 211 | type: messageTypes.STDIO_PAYLOAD, | |
| 212 | 212 | stream: this[kName], | |
| 213 | - chunk, | ||
| 214 | - encoding | ||
| 213 | + chunks: chunks.map(({ chunk, encoding }) => ({ chunk, encoding })) | ||
| 215 | 214 | }); | |
| 216 | 215 | this[kWritableCallbacks].push(cb); | |
| 217 | 216 | if (this[kPort][kWaitingStreams]++ === 0) | |
@@ -222,7 +221,7 @@ class WritableWorkerStdio extends Writable { | |||
| 222 | 221 | this[kPort].postMessage({ | |
| 223 | 222 | type: messageTypes.STDIO_PAYLOAD, | |
| 224 | 223 | stream: this[kName], | |
| 225 | - chunk: null | ||
| 224 | + chunks: [ { chunk: null, encoding: '' } ] | ||
| 226 | 225 | }); | |
| 227 | 226 | cb(); | |
| 228 | 227 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments