Issue with multiple targets

In platformio.ini I have created an env with the following target in order to flash an ESP8266:

[env:my_env]
targets = clean, upload, uploadfs, monitor

(other options are omitted for brevity)

I would expect they run sequentially, instead they run in parallel. Running in parallel, they lead to an obvious error since the last 3 targets try to acquire the serial port all together (the fastest target is monitor, so in the end upload and uploadfs fail).

What am I missing something?

That’s uh, unexpected. The documentation at

https://docs.platformio.org/en/latest/projectconf/sections/env/options/build/targets.html

also doesn’t say anything about concurrency (or in-sequence for that matter).

I would imagine that it just internally transforms it to pio run -t clean -t upload -t uploadfs -t monitor, but even then those should run sequentually.

Maybe some thoughts from @ivankravets?

1 Like

This is a known issue. Please report it to Issues · platformio/platformio-core · GitHub

A temporary solution is to pio run --jobs 1.

1 Like

Thanks for the workaround! I have opened the issue on github Issue with multiple targets · Issue #4604 · platformio/platformio-core (github.com)

1 Like