Path: blob/main/python/cpython/src/patches/09-set-inheritable.patch
1067 views
--- native/Python/fileutils.c 2022-09-11 12:23:30.000000000 -07001+++ wasm/Python/fileutils.c 2022-09-18 11:58:42.000000000 -07002@@ -1323,11 +1323,25 @@3return get_inheritable(fd, 1);4}56+extern int python_wasm_set_inheritable(int fd, int inheritable);78/* This function MUST be kept async-signal-safe on POSIX when raise=0. */9static int10set_inheritable(int fd, int inheritable, int raise, int *atomic_flag_works)11{12+ // For python-wasm we *have* to write this ourselves, since fcntl is13+ // built into upstream WASI and it makes this sort of stuff a no-op, or14+ // at least no functions in wasi get called. Note that this has limited15+ // impact, e.g., it can only work in a WASI context for certain types of16+ // fd's, e.g., pipes.17+ int result = python_wasm_set_inheritable(fd, inheritable);18+ if (result < 0) {19+ if (raise)20+ PyErr_SetFromErrno(PyExc_OSError);21+ return -1;22+ }23+ return 0;24+25#ifdef MS_WINDOWS26HANDLE handle;27DWORD flags;282930