Skip to content

Commit 9145242

Browse files
committed
Remove unnecessary mention of os.fsync() from os.exec*() docs
Before a process is replaced by os.exec*(), userspace buffers usually need to be flushed. However, it is not necessary to flush kernel buffers to disk using os.fsync(). Flushing userspace buffer to kernel, and flushing kernel buffer to disk, are two different things. In addition, os.fsync() is not applicable to pipes or sockets. This patch removes this confusing information.
1 parent 345fdce commit 9145242

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

Doc/library/os.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4318,11 +4318,10 @@ to be ignored.
43184318
and will have the same process id as the caller. Errors will be reported as
43194319
:exc:`OSError` exceptions.
43204320

4321-
The current process is replaced immediately. Open file objects and
4322-
descriptors are not flushed, so if there may be data buffered
4323-
on these open files, you should flush them using
4324-
:func:`sys.stdout.flush` or :func:`os.fsync` before calling an
4325-
:func:`exec\* <execl>` function.
4321+
The current process is replaced immediately. Open file objects are not
4322+
flushed, so if there may be data buffered on these open files, you should
4323+
flush them using :meth:`~io.IOBase.flush`, e.g. ``sys.stdout.flush()``,
4324+
before calling an :func:`exec\* <execl>` function.
43264325

43274326
The "l" and "v" variants of the :func:`exec\* <execl>` functions differ in how
43284327
command-line arguments are passed. The "l" variants are perhaps the easiest

0 commit comments

Comments
 (0)