GithubHelp home page GithubHelp logo

Comments (4)

kadaan avatar kadaan commented on July 19, 2024

It does seem to be working some of the time. I've yet to determine why is it not working all the time. Some scripts correctly respond to SIGINT when run but they don't when run via devbox run.

from devbox.

kadaan avatar kadaan commented on July 19, 2024

This seems similar to the issues that this PR fixed in dagger: dagger/dagger#5712

Their change is essentially doing the following to nix/run.go:

cmd := exec.CommandContext(ctx, shPath, "-c", cmdWithArgs)
	cmd.Env = envPairs
	cmd.Dir = projectDir
	cmd.Stdin = os.Stdin
	cmd.Stdout = os.Stdout
	cmd.Stderr = os.Stderr
	cmd.Cancel = func() error {
		return syscall.Kill(cmd.Process.Pid, syscall.SIGTERM)
	}

With my limited testing, this seems to fix the issue.

from devbox.

gcurtis avatar gcurtis commented on July 19, 2024

Thanks for the submitting a PR with your fix. I'd still like to understand a bit more why this is happening. Could you provide a few more details?

  • What's the exact script that's not responding to SIGINT?
  • What shell are you using (for running devbox and the script)?
  • Are you sending SIGINT by pressing ctrl-c in the shell? Or are you signaling the devbox process directly?
  • Is this happening on macOS or Linux?

When I try to repro using this config:

{
  "shell": {
    "scripts": {
      "zzz": "/bin/sleep 5"
    }
  }
}

and run devbox run zzz followed by ctrl-c, the sleep process exits. This is what I'd expect because the shell should be signaling the entire process group.

from devbox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.