Skip to content

Commit 68752e8

Browse files
jjmaestroCommitfest Bot
authored andcommitted
fix: 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. For more info, see the following thread: https://www.postgresql.org/message-id/ot4w2y6es446gjgvhbpp45qt3wx65n5epjxgsu3ghgr63yuizn%40qeurkcofswmv
1 parent 2652835 commit 68752e8

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)