aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2025-06-30 12:23:33 +0200
committerPeter Eisentraut <peter@eisentraut.org>2025-06-30 12:24:48 +0200
commit40a96cd1484fdf3ab57e8cb7b09767ec7a7f73b1 (patch)
tree52003bfcbecff2ba48f68a603d1c70297a1f82ca /src
parentcc2ac0e6f99e4efc3ae5710010ff35e646990a60 (diff)
downloadpostgresql-40a96cd1484fdf3ab57e8cb7b09767ec7a7f73b1.tar.gz
postgresql-40a96cd1484fdf3ab57e8cb7b09767ec7a7f73b1.zip
pgflex: propagate environment to flex subprocess
Python's subprocess.run docs say that if the env argument is not None, it will be used "instead of the default behavior of inheriting the current process’ environment". However, the environment should be preserved, only adding FLEX_TMP_DIR to it. Author: Javier Maestro <jjmaestro@ieee.org> Discussion: https://www.postgresql.org/message-id/flat/CABvji06GUpmrTqqiCr6_F9vRL2-JUSVAh8ChgWa6k47FUCvYmA%40mail.gmail.com
Diffstat (limited to 'src')
-rwxr-xr-xsrc/tools/pgflex4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tools/pgflex b/src/tools/pgflex
index 3986b06874e..b8d9aa0086f 100755
--- a/src/tools/pgflex
+++ b/src/tools/pgflex
@@ -48,7 +48,7 @@ os.chdir(args.privatedir)
# contents. Set FLEX_TMP_DIR to the target private directory to avoid
# that. That environment variable isn't consulted on other platforms, so we
# don't even need to make this conditional.
-env = {'FLEX_TMP_DIR': args.privatedir}
+os.environ['FLEX_TMP_DIR'] = args.privatedir
# build flex invocation
command = [args.flex, '-o', args.output_file]
@@ -58,7 +58,7 @@ command += args.flex_flags
command += [args.input_file]
# create .c file from .l file
-sp = subprocess.run(command, env=env)
+sp = subprocess.run(command)
if sp.returncode != 0:
sys.exit(sp.returncode)