I am working on a project that has two types of binaries: the Service and the Worker.
At the end the Worker is going to be spawned by the Service to do tasks that the Service cannot do on its own but how can the Service reference the Worker?
In the best case both binaries and the CWD are in the same folder and I can just open them, but that is not always the case, especially not when invoked with zig build run.
I’ve thought about using Step.Compile.getEmittedBin in the build system but that would then reference the cache artifact and not wherever it is installed at the end.
Maybe the best solution is to look in the local directory first and then somewhere else? Has anyone done this before?
I think I’m missing what you are trying to do. Is the point that you want something like std.process.Child, but you don’t know what argv[0] (i.e. /path/to/Worker) should be?
another solution, potentially, would be to use something like fork more directly in your code?
Practically this.
The actual implementation is going to actually execute bubblewrap and pass the Worker into the container either via path or file handle.
gotcha. well, I’m still not sure, but probably whoever is sure to know where the file is should be made responsible for telling Service that. one way to do this within the build system is the addFileArg method on Step.Run which can be passed a LazyPath
Turns out that does not work because std.Build.LazyPath is a union and those are not supported as build options yet.
0.17 is going to get remove LazyPath.getPath() so that isn’t an option in the long-term.
I think that’s gonna be the short-term solution I go with but I gotta figure out how to deal with this when installing.
It doesn’t help that accessing the install prefix in the build system is unsupported so I wouldn’t even be able to stitch together a path to it.