Nodemon: Nodemon SIGINT ์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ๊ฐ€ Yarn๊ณผ ์ถฉ๋Œํ•ฉ๋‹ˆ๋‹ค.

์— ๋งŒ๋“  2018๋…„ 04์›” 30์ผ  ยท  4์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: remy/nodemon

package.json :

{
  ...
  "scripts": {
    "start": "node start.js"
  }
}

start.js :

require('nodemon');
setTimeout(() => {}, 1e6);

ํ„ฐ๋ฏธ๋„์—์„œ :

# Does not print anything (except `grep` itself), i.e. no node process is running
$ ps aux | grep node
# We run the `start` task then interrupt it with CTRL-C
$ yarn start
yarn run v1.6.0
node start.js
^C
# yarn was killed, but not `start.js`
$ ps aux | grep node
me     4053  0.0  0.0   4608   876 pts/2    S    14:29   0:00 /bin/sh -c node start.js
me     4054  0.0  0.0 873592 28564 pts/2    Sl   14:29   0:00 node start.js

require('nodemon') ์ค„์ด ์—†์œผ๋ฉด start.js ํ”„๋กœ์„ธ์Šค๊ฐ€ ์‹ค์— ์˜ํ•ด ์ œ๋Œ€๋กœ ์ข…๋ฃŒ๋ฉ๋‹ˆ๋‹ค.

npm run ์—์„œ๋Š” ๋ฌธ์ œ๊ฐ€๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. https://github.com/yarnpkg/yarn/issues/4667 ๊ณผ ๊ด€๋ จ์ด์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค (ํ™•์‹คํ•˜์ง€ ์•Š์Œ)

ํ•„์š”ํ•œ ๊ฒฝ์šฐ Nodemon์€ SIGINT ์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค. ์‹ค์ด์ง€๋ฉด CTRL-C , ๊ทธ๊ฒƒ์€ ์•ž์œผ๋กœ ๊ทธ๊ฒƒ์— script.js ์žˆ๊ธฐ ๋•Œ๋ฌธ์—์ด ์•„๋ฌด๊ฒƒ๋„ ์‹คํ–‰ SIGINT ์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ๋ฅผ ๊ฐ€์ง€๊ณ ์žˆ๋‹ค.

์ด ์˜ˆ์ œ๋Š” ๋ฌธ์ œ๋ฅผ ์ •ํ™•ํžˆ ํŒŒ์•…ํ•˜๊ธฐ ์œ„ํ•ด ์•ฝ๊ฐ„ ๊ณ ์•ˆ๋˜์—ˆ์ง€๋งŒ ์‹ค์ œ ์‹œ๋‚˜๋ฆฌ์˜ค์—์„œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

  • setTimeout() ๋Œ€์‹  gulp.watch()
  • Nodemon์ด ํ•„์š”ํ•˜์ง€๋งŒ ํŠน์ • Gulp ์ž‘์—…์œผ๋กœ ๋งŒ ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค.
  • ์ด๋กœ ์ธํ•ด Gulp๊ฐ€ Yarn์„ ํ†ตํ•ด ์‹คํ–‰๋  ๋•Œ CTRL-C ์—์„œ Gulp ๊ฐ์‹œ ์ž‘์—…์ด ์ข…๋ฃŒ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

ํ•œ ๊ฐ€์ง€ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์€ Nodemon์„ ์ธ์Šคํ„ด์Šคํ™” ํ•  ๋•Œ๋งŒ ์กฐ๊ฑด๋ถ€๋กœ Nodemon์„ ์š”๊ตฌํ•˜๋Š” ๊ฒƒ์ด์ง€๋งŒ ์‹ค์ œ ์†”๋ฃจ์…˜ ์ด๋ผ๊ธฐ๋ณด๋‹ค๋Š” ํ•ดํ‚น์ฒ˜๋Ÿผ ๋Š๊ปด์ง‘๋‹ˆ๋‹ค.

๋ฒ„์ „ : Node.js 8.11.0, Nodemon 1.17.3, yarn 1.6.0, Ubuntu 17.10

bug has PR

๋ชจ๋“  4 ๋Œ“๊ธ€

๊ทธ๊ฒƒ์€ _is_ yarn, ๋‚˜๋Š” yarn์œผ๋กœ ๋ณต์ œ ํ•  ์ˆ˜ ์žˆ์ง€๋งŒ npm์œผ๋กœ๋Š” ๋ณต์ œ ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

screen shot 2018-04-30 at 14 51 02

_ํ•˜์ง€๋งŒ _ ๊ทธ๊ฒƒ์€ ๋˜ํ•œ nodemon ๋‚ด๋ถ€์—์„œ๋„ ๊ณ ์น  ์ˆ˜์žˆ๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๊ผญ ๋ถ™์žก์•„.

์˜ˆ, PR์€์ด ๋ฌธ์ œ๋ฅผ ์ง์ ‘ ํ•ด๊ฒฐํ•˜๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค! ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ๋น ๋ฅด ๋„ค์š”!

@ehmicky ๋Š” ํŠน๋ณ„ํžˆ ๋น ๋ฅด์ง€๋Š” ์•Š์Šต๋‹ˆ๋‹ค. ์•„์ด๋“ค์—๊ฒŒ ์ €๋… ์‹์‚ฌ๋ฅผํ•˜๊ธฐ ์ „์—

@remy ์•„๋งˆ๋„ ๋‹ค๋ฅธ ๋ฌธ์ œ์ธ์ง€ ํ™•์‹คํ•˜์ง€ ์•Š์ง€๋งŒ ์—ฌ์ „ํžˆ
nodemon ๋กœ ํ”„๋กœ์„ธ์Šค๋ฅผ ์ง์ ‘ ์‹คํ–‰ํ•˜๋ฉด ๋ฌธ์ œ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. yarn ์‹คํ–‰ํ•˜๋ฉด ๋ฌธ์ œ ์—†์Šต๋‹ˆ๋‹ค. yarn ์™€ nodemon ๋ฅผ ๊ฒฐํ•ฉํ•˜๋ฉด CTRL-C๋ฅผ ๋‘ ๋ฒˆ ๋ˆŒ๋Ÿฌ์•ผํ•˜๋Š” ํ”„๋กœ์„ธ์Šค๋ฅผ ์ข…๋ฃŒ ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

์ž์„ธํ•œ ๋‚ด์šฉ์€ https://superuser.com/questions/1594660/why-does-zsh-keep-running-after-exiting-a-process-with-ctrl-c-until-ctrl ์—์„œ SO ์งˆ๋ฌธ์„ ๋งŒ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค.

https://github.com/remy/nodemon/issues/1647 ๋„

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰