| 373 | |
| 374 | @run_in_pyodide |
| 375 | def test_dup_pipe(selenium): |
| 376 | # See https://github.com/emscripten-core/emscripten/issues/14640 |
| 377 | import os |
| 378 | |
| 379 | [fdr1, fdw1] = os.pipe() |
| 380 | fdr2 = os.dup(fdr1) |
| 381 | fdw2 = os.dup2(fdw1, 50) |
| 382 | # Closing any of fdr, fdr2, fdw, or fdw2 will currently destroy the pipe. |
| 383 | # This bug is fixed upstream: |
| 384 | # https://github.com/emscripten-core/emscripten/pull/14685 |
| 385 | s1 = b"some stuff" |
| 386 | s2 = b"other stuff to write" |
| 387 | os.write(fdw1, s1) |
| 388 | assert os.read(fdr2, 100) == s1 |
| 389 | os.write(fdw2, s2) |
| 390 | assert os.read(fdr1, 100) == s2 |
| 391 | |
| 392 | |
| 393 | @run_in_pyodide |