根据 npm start 停止所有进程... [英] Stop all processes depending on npm start…

查看:179
本文介绍了根据 npm start 停止所有进程...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在并行启动多个 npm 任务(使用 &,而不仅仅是按顺序&&).因此在 package.json 中:

I am starting multiple npm tasks in parallel (using &, not just in sequence &&). Thus in package.json:

"start": "npm run watch-blog & npm run watch-data & npm run server",

这些子任务对我来说是有用的东西:

And those sub-tasks are useful stuff to me like:

"watch-blog" : "watchy -w _posts/**/* -- touch _pages/blog.md",

问题:我怎样才能同时关闭所有三个任务?

我注意到 CTRLC 只会杀死最后一个.(我的观看博客幸存下来并保持感动")

Question: How can I all shut down all three tasks together?

I noticed CTRLC is only killing the last. (my watch-blog survives and keeps „touching")

关闭终端窗口没有帮助.只有 killall node 可以完成这项工作,但这比我想的要多……

Closing the terminal window doesn't help. Only killall node does the job, but that's killing more than I would like to…

推荐答案

杀死分离的进程(就是这个词……)会很痛苦.人们将不得不查看 pids,以及更多的东西.更不用说跨平台问题了,如果要在 windows 下工作的话...

Killing detached processes (that's the word…) will be a pain. One will have to look at pids, and more stuff coming your way. Not to mention cross-platform issues, if meant to work under windows...

更容易和工作:

npm install concurrently --save

因此

"start": "concurrently \"npm run watch-blog\" \"npm run watch-data\" \"npm run serve\"",

已测试(在 Ubuntu 16.04、npm 5.6 下).

Tested (under Ubuntu 16.04, npm 5.6).

这篇关于根据 npm start 停止所有进程...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆