Run a command after a chroot

Hello, I would like to ask you a question. It’s a special request.

How is it possible with crystal to run a chroot process and then execute one or some commands inside the chroot?

Because I tried to run a chroot command with, and it work, but after the process end because it work properly.

How can I do ?

Nobody ? I really need this work for my project.

In one word, I need to run in a Process a chroot command, and then run a command .

The main problem actually is, if I run a chroot command with the Process class, when it successfully chroot, the process end, and I can’t do anything

How are you running the chroot command? I’ve never used it before, but if I need to run two commands in the same Process, I tend to separate them by the “&&” operator.

Some example code might be helpful too.

EDIT: I just looked up the chroot command, and it looks like it accepts an arbitrary command to run as the last argument(s). So the “&&” wouldn’t be needed.

Yeah I know what you said , thank you for your suggestions. But unfortunately it’s not enough, because for some case , I need to run some commands together. Because the problem when I run a command with the chroot command, it’s always at the path /, but in some case I need to run a command configure from a build path in a source directory.

So you know any trick to do that ? Because actually I need to found a workaround for that.

This can be done by Ansible, this is not what you are looking for, but Ansible is Open Source and written in Python, maybe you can find how they do it and use it in your Crystal project