Skip to content

Commit 40a96cd

Browse files
committed
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
1 parent cc2ac0e commit 40a96cd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/tools/pgflex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ os.chdir(args.privatedir)
4848
# contents. Set FLEX_TMP_DIR to the target private directory to avoid
4949
# that. That environment variable isn't consulted on other platforms, so we
5050
# don't even need to make this conditional.
51-
env = {'FLEX_TMP_DIR': args.privatedir}
51+
os.environ['FLEX_TMP_DIR'] = args.privatedir
5252

5353
# build flex invocation
5454
command = [args.flex, '-o', args.output_file]
@@ -58,7 +58,7 @@ command += args.flex_flags
5858
command += [args.input_file]
5959

6060
# create .c file from .l file
61-
sp = subprocess.run(command, env=env)
61+
sp = subprocess.run(command)
6262
if sp.returncode != 0:
6363
sys.exit(sp.returncode)
6464

0 commit comments

Comments
 (0)