MCPcopy
hub / github.com/pyodide/pyodide / test_dup_pipe

Function test_dup_pipe

src/tests/test_pyodide.py:375–390  ·  view source on GitHub ↗
(selenium)

Source from the content-addressed store, hash-verified

373
374@run_in_pyodide
375def 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

Callers

nothing calls this directly

Calls 3

dupMethod · 0.80
writeMethod · 0.65
readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…