[ruby-talk:443042] bundler - subprocess question

Hello Rubyists,

I have a Ruby program A where I want to spawn subprocess B, and have that
subprocess do work with a separate set of dependencies.

* process A accepts incoming API requests to run an automated test suite

* process A spawns process B

* process B runs the test suite using cucumber

* process A has no knowledge of cucumber

I've tried a few different ways but end up with errors like this:

block in replace_bin_path': can't find executable cucumber for gem
cucumber. cucumber is not currently included in the bundle, perhaps you
meant to add it to your Gemfile?

So the question -- is it possible to spawn a subprocess and be able to
control what bundler environment is used by the subprocess ?

Thanks !!

···

--
A musician must make music, an artist must paint, a poet must write, if he
is to be ultimately at peace with himself.
- Abraham Maslow

Run block with all bundler-related variables removed:
https://www.rubydoc.info/github/bundler/bundler/Bundler.with_unbundled_env

Run subcommand in an environment with all bundler related variables
removed:
https://www.rubydoc.info/github/bundler/bundler/Bundler.unbundled_system

Run a `Kernel.exec` to a subcommand in an environment with all bundler
related variables removed:
https://www.rubydoc.info/github/bundler/bundler/Bundler.unbundled_exec

···

On 10/7/22, Sean Felipe Wolfe <ether.joe@gmail.com> wrote:

I have a Ruby program A where I want to spawn subprocess B, and have that
subprocess do work with a separate set of dependencies.

So the question -- is it possible to spawn a subprocess and be able to
control what bundler environment is used by the subprocess ?

Thanks !!

···

On Fri, Oct 7, 2022 at 5:50 PM Frank J. Cameron <fjc@fastmail.net> wrote:

On 10/7/22, Sean Felipe Wolfe <ether.joe@gmail.com> wrote:
> I have a Ruby program A where I want to spawn subprocess B, and have that
> subprocess do work with a separate set of dependencies.
>
> So the question -- is it possible to spawn a subprocess and be able to
> control what bundler environment is used by the subprocess ?

Run block with all bundler-related variables removed:
Method: Bundler.with_unbundled_env — Documentation for bundler/bundler (master)

Run subcommand in an environment with all bundler related variables
removed:
https://www.rubydoc.info/github/bundler/bundler/Bundler.unbundled_system

Run a `Kernel.exec` to a subcommand in an environment with all bundler
related variables removed:
https://www.rubydoc.info/github/bundler/bundler/Bundler.unbundled_exec