How to invoke an executable from an SPM plugin without Foundation?

the title says it all, but i have been trying all afternoon to figure this out. for a build tool, a plugin can just return a _buildCommand and SPM will launch the process for you (with Foundation i think), but a command plugin can’t talk to PluginHostConnection, it has to invoke the executable tool on its own, and i really don’t want fall back on Foundation Process because that would go against my longstanding no-Foundation import policy.

if i got rid of the plugin altogether and just used a regular executable that wouldn’t work either because it needs to know where the source files are in the project because it is a source generator.

Sounds a reasonable feature request for swift-system?

3 Likes

It definitely is, but in the interim give posix_spawn a shot. This will allow you to avoid using Foundation at the cost of a non trivial but manageable C api.

2 Likes