Skip to content

Commit e8f0706

Browse files
committedMay 9, 2021
Make --restart-tries restart forever with negative value
Closes #263
1 parent aad79fa commit e8f0706

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed
 

‎README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,10 @@ Killing other processes
169169
code [boolean]
170170
171171
Restarting
172-
--restart-tries How many times a process that died should restart.
172+
--restart-tries How many times a process that died should restart.
173+
Negative numbers will make the process restart forever.
173174
[number] [default: 0]
174-
--restart-after Delay time to respawn the process, in milliseconds.
175+
--restart-after Delay time to respawn the process, in milliseconds.
175176
[number] [default: 0]
176177
177178
Options:

‎bin/concurrently.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ const args = yargs
107107

108108
// Restarting
109109
'restart-tries': {
110-
describe: 'How many times a process that died should restart.',
110+
describe:
111+
'How many times a process that died should restart.\n' +
112+
'Negative numbers will make the process restart forever.',
111113
default: defaults.restartTries,
112114
type: 'number'
113115
},

‎src/flow-control/restart-process.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports = class RestartProcess {
77
constructor({ delay, tries, logger, scheduler }) {
88
this.delay = +delay || defaults.restartDelay;
99
this.tries = +tries || defaults.restartTries;
10+
this.tries = this.tries < 0 ? Infinity : this.tries;
1011
this.logger = logger;
1112
this.scheduler = scheduler;
1213
}

‎src/flow-control/restart-process.spec.js

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ it('restarts processes up to tries', () => {
6969
expect(commands[0].start).toHaveBeenCalledTimes(2);
7070
});
7171

72+
it.todo('restart processes forever, if tries is negative');
73+
7274
it('restarts processes until they succeed', () => {
7375
controller.handle(commands);
7476

0 commit comments

Comments
 (0)
Please sign in to comment.