How to issue "ctrl+c" to tell a command in a just recipe to stop without killing just itself

46 Views Asked by At

I'm using a justfile to start a backend through docker-compose before npm run dev.

I would like just to run docker compose stop backend after I stop npm run dev through ctrl+c but my attempt doesn't seem to work:

webdev: (up-latest "backend" "-d") && (compose-stop "backend")
    cd website && npm run dev

up-latest target='' daemon='':
    docker compose up {{target}} {{daemon}}

compose-stop target='':
    docker compose stop {{target}}

When I run just webdev, everything works as expected. But when I hit ctrl+c just exits without running compose-stop.

If I understand it correctly, that's because ctrl+c is caught by just and shuts it down entirely rather than forwarding the ctrl+c to npm run dev.

So my question is: how can I send a kill signal to a recipe rather than just?

0

There are 0 best solutions below