Skip to content

Commit bf582e1

Browse files
authored
Merge pull request #4561 from codpot/fix-disabling-logs
Fix disabling logs
2 parents 69984f0 + f3259c0 commit bf582e1

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lib/Common.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ Common.prepareAppConf = function(opts, app) {
214214

215215
if ((f == 'log' && typeof af == 'boolean' && af) || (f != 'log' && !af)) {
216216
ps = [cst['DEFAULT_' + ext.toUpperCase() + '_PATH'], formated_app_name + (isStd ? '-' + f : '') + '.' + ext];
217-
} else if (f != 'log' || (f == 'log' && af)) {
217+
} else if ((f != 'log' || (f == 'log' && af)) && af !== 'NULL' && af !== '/dev/null') {
218218
ps = [cwd, af];
219219

220220
var dir = path.dirname(path.resolve(cwd, af));
@@ -233,7 +233,13 @@ Common.prepareAppConf = function(opts, app) {
233233

234234
}
235235
// PM2 paths
236-
ps && (app['pm_' + (isStd ? f.substr(0, 3) + '_' : '') + ext + '_path'] = path.resolve.apply(null, ps));
236+
if (af !== 'NULL' && af !== '/dev/null') {
237+
ps && (app['pm_' + (isStd ? f.substr(0, 3) + '_' : '') + ext + '_path'] = path.resolve.apply(null, ps));
238+
} else if (path.sep === '\\') {
239+
app['pm_' + (isStd ? f.substr(0, 3) + '_' : '') + ext + '_path'] = '\\\\.\\NUL';
240+
} else {
241+
app['pm_' + (isStd ? f.substr(0, 3) + '_' : '') + ext + '_path'] = '/dev/null';
242+
}
237243
delete app[f + '_file'];
238244
});
239245

lib/Utility.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ var Utility = module.exports = {
260260
},
261261

262262
checkPathIsNull: function(path) {
263-
return path === 'NULL' || path === '/dev/null';
263+
return path === 'NULL' || path === '/dev/null' || path === '\\\\.\\NUL';
264264
},
265265

266266
generateUUID: function () {

0 commit comments

Comments
 (0)