On this page
  1. posix.dup2
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

posix.dup2

Prev: posix.dup | Up: posix | Next: posix.error
Rel: posix.abort, posix.access, posix.chdir, posix.chflags
Ref: docs.python.org — posix.dup2
Tags: #public #python3 #stdlib #posix


Import

import posix
from posix import dup2

Signature & Overview

posix.dup2(fd, fd2, inheritable=True)

Duplicate file descriptor.

Usage

import os

# Duplicates fd onto fd2 (closing fd2 first if open)
assert callable(os.dup2)

Gotchas

REPL Inspect

from posix import dup2
help(dup2)

Linked from

Related notes