MCPcopy
hub / github.com/django/django / popen_wrapper

Function popen_wrapper

django/core/management/utils.py:17–31  ·  view source on GitHub ↗

Friendly wrapper around Popen. Return stdout output, stderr output, and OS status code.

(args, stdout_encoding="utf-8")

Source from the content-addressed store, hash-verified

15
16
17def popen_wrapper(args, stdout_encoding="utf-8"):
18 """
19 Friendly wrapper around Popen.
20
21 Return stdout output, stderr output, and OS status code.
22 """
23 try:
24 p = run(args, capture_output=True, close_fds=os.name != "nt")
25 except OSError as err:
26 raise CommandError("Error executing %s" % args[0]) from err
27 return (
28 p.stdout.decode(stdout_encoding),
29 p.stderr.decode(DEFAULT_LOCALE_ENCODING, errors="replace"),
30 p.returncode,
31 )
32
33
34def handle_extensions(extensions):

Callers 7

gettext_versionMethod · 0.90
build_potfilesMethod · 0.90
process_locale_dirMethod · 0.90
write_po_fileMethod · 0.90
msgfmt_versionMethod · 0.90

Calls 3

CommandErrorClass · 0.85
runFunction · 0.50
decodeMethod · 0.45

Tested by 3

msgfmt_versionMethod · 0.72