cargo-make: script hangs terminal

Describe the bug Running a task that launches npx webpack-dev-server causes a hang in windows when exiting

To Reproduce

  1. Install node, npm, etc.
  2. Create a minimal webpack project (and install webpack-dev-server)
  3. Start the webpack-dev-server via npx directly:
npx webpack-dev-server --config webpack.config.js
  1. Control-C to break out
  2. No problem so far… can type on the console, task manager looks clean - all good
  3. Now try via cargo make
  4. Create following in Makefile.toml
[tasks.webpack-development-server]
script = ["npx webpack-dev-server --config webpack.config.js"]
  1. Launch it via cargo make webpack-development-server
  2. Starts fine
  3. Control-C to exit
  4. Appears to exit but then terminal is messed up - can’t enter text
  5. Also task manager shows additional consoles (this is after hitting control-c in the terminal but before closing the window entirely):

image

Error Stack

None - it’s just that the terminal becomes unusable

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 29 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Can’t check today but will try tomorrow… in the meantime, thanks 😃

I found a workaround by abusing the script command. script will swallow <kbd>Ctrl</kbd><kbd>C</kbd> and does not require super user permissions like setsid.

I’ve updated my dummy project with an example.

I’ll keep an eye out for a cargo-make update with a flag or option, since that will be a lot less hacky.

scripts are executed in the command.rs and it is using another library run_script (also mine) which creates a script file and executes it.