Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Support Graceful Restarts #2716

Closed
wants to merge 1 commit into from

7 participants

@scien

npm/npm#1999

npm restart currently runs prestop, stop, poststop, restart, prestart, start, poststart. According to the docs, and the original intention of the feature, a restart script should be able to be provided so the application can choose to restart their service gracefully (see npm/npm#184) instead of issueing a full stop/start.

Note: npm restart will run the stop and start scripts if no restart script is provided.

A full stop/start should only happen if a restart script is not provided.

@ralt

Looks like the commit log should be "Don't run restart if it doesn't exist", shouldn't it? I'm confused between your description and the code in the commit.

@domenic
Collaborator

No, the commit message makes sense. LGTM, @isaacs?

@luk-

LGTM

@eliasgs

Why isn't this merged?

@luk-

I think we can probably merge this if someone wants to update the docs for it as well. If not, I can tomorrow or sometime this week.

@timoxley
Collaborator

@scien want to add "npm restart will run the stop and start scripts if no restart script is provided." to the docs?

#4430

@eliasgs

The docs says:
This runs a package's "restart" script, if one was provided. Otherwise it runs package's "stop" script, if one was provided, and then the "start" script.
It seems to sufficiently describe the functionality, if this pull request gets merged?

I think this should just be merged already:)

@domenic
Collaborator

This needs a test before it can be merged.

@domenic domenic added the needs-tests label
@othiym23
Owner

This has been waiting for a test without getting one for over a year. Closing as abandoned. Thanks for taking the time to put it together, @scien, and sorry we let it languish for so long without providing feedback. If you want to take another stab at this, a new version, with tests, would be welcome.

@othiym23 othiym23 closed this
@othiym23 othiym23 removed the review label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 14, 2012
  1. @scien
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 2 deletions.
  1. +1 −2  lib/run-script.js
View
3  lib/run-script.js
@@ -80,9 +80,8 @@ function runScript (args, cb) {
function run (pkg, wd, cmd, cb) {
var cmds = []
if (!pkg.scripts) pkg.scripts = {}
- if (cmd === "restart") {
+ if (!pkg.scripts.restart && cmd === "restart") {
cmds = ["prestop","stop","poststop"
- ,"restart"
,"prestart","start","poststart"]
} else {
cmds = [cmd]
Something went wrong with that request. Please try again.