Pio remote run --force-remote and environment variables

TLDR; environment variables set aren’t propagated when using pio remote run --force-remote.

I have a project that is configurable using a #define to control whether the firmware waits for a serial connection or not. Handy for development, but not so much for CI, so this feature is switched off in the CI build.

I set `PLATFORMIO_BUILD_FLAGS=“-DNO_WAIT_FOR_SERIAL” in the environment but found that this wasn’t propagated to the agent. Is this expected?

The workaround for me was to simply not use force-remote.

I looked but didn’t find any documentation for this behavior, which was surprising since environment variables are a key part of project configuration.

Can you file a bug in Issues · platformio/platformio-core · GitHub?