Pre and post actions locally before remote tests/upload

With the docs on advanced scripting, I can create nice pre and post actions that platformio runs before uploading code. Those also work with pio test just before the test code is uploaded. But if I run pio remote test, the actions aren’t being run. My action is actually an ssh command that I want platformio to execute before/after uploading. It doesn’t matter what machine it runs on (local or the remote agent), since it is an ssh command anyway. How can I apply the pre/post actions also using pio remote? The docs are a little slim on what the env variable contains and allows me to do (a lot of functions seem to be in there that I can’t find docs on).

EDIT: The question here clarifies some of it: PIO remote upload does not run extra scripts. I understand that by default only the binary code and stuff is transferred to the remote host so extra scripts don’t run there. And with --force-remote you can force the compilation on the remote host, which would allow me to run scripts on the remote host. But I want neither, I want the script to run on the local machine, not on the remote host, but just before uploading. The problem is that compilation takes a while, so if I execute a script manually before my pio remote call, there is a lot of time before the actual upload happens. I want my command to run after compiling, but before uploading, so it happens just before the upload.
I could do that with the force-remote on the remote machine, if the remote machine, but there is no compiler for that machine (linux_armv7l). So I am kind of stuck.

Cheers,

Dolf

Looks like a candidate for a feature request to Issues · platformio/platformio-core · GitHub for @ivankravets to me, after what you’ve found out.

1 Like