Commit 4710349
child_process: fix exec set stdout.setEncoding
cp.exec decide to use `_stdout`(_stdout is string) or
`Buffer.concat(_stdout)`(_stdout is buffer array) by options.encoding.
but std(out|err) encoding can be changed. If encoding is changed to
not null, `_stdout` will become string, and `Buffer.concat(_stdout)`
will throw TypeError. This patch will fix it, use
options.encoding and `std(out|err)._readableState.encoding`.
PR-URL: #18976
Fixes: #18969
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>1 parent aaf1df5 commit 4710349Copy full SHA for 4710349
File tree
Expand file treeCollapse file tree
5 files changed
+82
-14
lines changedOpen diff view settings
Filter options
- lib
- test/parallel
Expand file treeCollapse file tree
5 files changed
+82
-14
lines changedOpen diff view settings
Collapse file
+2-1Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
324 | 324 | |
325 | 325 | |
326 | 326 | |
327 | | - |
| 327 | + |
| 328 | + |
328 | 329 | |
329 | 330 | |
330 | 331 | |
|
Collapse file
+20-13Lines changed: 20 additions & 13 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
226 | 226 | |
227 | 227 | |
228 | 228 | |
229 | | - |
230 | | - |
| 229 | + |
| 230 | + |
231 | 231 | |
232 | 232 | |
233 | | - |
234 | | - |
235 | 233 | |
236 | | - |
237 | | - |
238 | 234 | |
239 | 235 | |
240 | 236 | |
| ||
261 | 257 | |
262 | 258 | |
263 | 259 | |
264 | | - |
265 | | - |
266 | | - |
| 260 | + |
| 261 | + |
| 262 | + |
| 263 | + |
| 264 | + |
| 265 | + |
| 266 | + |
267 | 267 | |
268 | 268 | |
| 269 | + |
| 270 | + |
| 271 | + |
| 272 | + |
| 273 | + |
| 274 | + |
| 275 | + |
| 276 | + |
| 277 | + |
269 | 278 | |
270 | 279 | |
271 | 280 | |
| ||
329 | 338 | |
330 | 339 | |
331 | 340 | |
| 341 | + |
332 | 342 | |
333 | 343 | |
334 | 344 | |
335 | 345 | |
336 | 346 | |
337 | | - |
338 | | - |
339 | 347 | |
340 | 348 | |
341 | 349 | |
| ||
347 | 355 | |
348 | 356 | |
349 | 357 | |
| 358 | + |
350 | 359 | |
351 | 360 | |
352 | 361 | |
353 | 362 | |
354 | 363 | |
355 | | - |
356 | | - |
357 | 364 | |
358 | 365 | |
359 | 366 | |
|
Collapse file
test/parallel/test-child-process-exec-maxBuffer.js
Copy file name to clipboardExpand all lines: test/parallel/test-child-process-exec-maxBuffer.js+22Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
41 | 41 | |
42 | 42 | |
43 | 43 | |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
Collapse file
test/parallel/test-child-process-exec-std-encoding.js
Copy file name to clipboard+23Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
Collapse file
test/parallel/test-stream-readable-setEncoding-null.js
Copy file name to clipboard+15Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
0 commit comments