From 39279a1e547e857118803a1644c6a6f0b9afca3f Mon Sep 17 00:00:00 2001 From: Tudor-Dan Ravoiu Date: Thu, 19 Nov 2020 16:48:13 +0200 Subject: [PATCH] Run grunt with debugger enabled (#8911) * Run grunt with debugger enabled When forking a node.js thread we are also having the possibility to pass some node.js arguments, such as "--inspect=0.0.0.0". By providing this, we are adding the capability of doing live debugging even when the system is started with grunt. * removed whitespace * Update Gruntfile.js --- Gruntfile.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index e25d9e12dd..e2a811cd11 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -143,8 +143,17 @@ module.exports = function (grunt) { if (worker) { worker.kill(); } + + const execArgv = []; + const inspect = process.argv.find(a => a.startsWith('--inspect')); + + if (inspect) { + execArgv.push(inspect); + } + worker = fork('app.js', args, { - env: env, + env, + execArgv, }); }