@@ -51,15 +51,6 @@ GhostServer.prototype.logStartMessages = function () {
51
51
config . url ,
52
52
'\nCtrl+C to shut down' . grey
53
53
) ;
54
-
55
- // ensure that Ghost exits correctly on Ctrl+C
56
- process . removeAllListeners ( 'SIGINT' ) . on ( 'SIGINT' , function ( ) {
57
- console . log (
58
- '\nGhost has shut down' . red ,
59
- '\nYour blog is now offline'
60
- ) ;
61
- process . exit ( 0 ) ;
62
- } ) ;
63
54
} else {
64
55
console . log (
65
56
( 'Ghost is running in ' + process . env . NODE_ENV + '...' ) . green ,
@@ -69,17 +60,27 @@ GhostServer.prototype.logStartMessages = function () {
69
60
config . url ,
70
61
'\nCtrl+C to shut down' . grey
71
62
) ;
72
- // ensure that Ghost exits correctly on Ctrl+C
73
- process . removeAllListeners ( 'SIGINT' ) . on ( 'SIGINT' , function ( ) {
63
+ }
64
+
65
+ function shutdown ( ) {
66
+ console . log ( '\nGhost has shut down' . red ) ;
67
+ if ( process . env . NODE_ENV === 'production' ) {
68
+ console . log (
69
+ '\nYour blog is now offline'
70
+ ) ;
71
+ } else {
74
72
console . log (
75
- '\nGhost has shutdown' . red ,
76
73
'\nGhost was running for' ,
77
74
Math . round ( process . uptime ( ) ) ,
78
75
'seconds'
79
76
) ;
80
- process . exit ( 0 ) ;
81
- } ) ;
77
+ }
78
+ process . exit ( 0 ) ;
82
79
}
80
+ // ensure that Ghost exits correctly on Ctrl+C and SIGTERM
81
+ process .
82
+ removeAllListeners ( 'SIGINT' ) . on ( 'SIGINT' , shutdown ) .
83
+ removeAllListeners ( 'SIGTERM' ) . on ( 'SIGTERM' , shutdown ) ;
83
84
} ;
84
85
85
86
GhostServer . prototype . logShutdownMessages = function ( ) {
0 commit comments