From 1af963cc47b3507e2f954642867ee34a81729013 Mon Sep 17 00:00:00 2001 From: Javier Maestro Date: Mon, 30 Sep 2024 14:47:19 +0100 Subject: [PATCH] fix: propagate M4 env variable to flex subprocess The pgflex wrapper runs flex with an explicit environment, so it doesn't inherit environment variables from the parent process. However, flex can use the M4 env variable and/or the PATH (via execvp) to find the m4 macro processor. --- src/tools/pgflex | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tools/pgflex b/src/tools/pgflex index baabe2d..15f766c 100755 --- a/src/tools/pgflex +++ b/src/tools/pgflex @@ -53,6 +53,11 @@ os.chdir(args.privatedir) # don't even need to make this conditional. env = {'FLEX_TMP_DIR': args.privatedir} +# flex honors the M4 env variable, so if it's set in the environment +# it should be propagated to the subprocess environment +if "M4" in os.environ: + env['M4'] = os.environ["M4"] + # build flex invocation command = [args.flex, '-o', args.output_file] if args.no_backup: -- 2.39.5 (Apple Git-154)