Skip to content

Commit 18d913b

Browse files
committed
internal: add custom dir support for heapsnapshot-signal
1 parent 9e5e2f1 commit 18d913b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/internal/process/pre_execution.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ function initializeReportSignalHandlers() {
365365

366366
function initializeHeapSnapshotSignalHandlers() {
367367
const signal = getOptionValue('--heapsnapshot-signal');
368+
const diagnosticDir = getOptionValue('--diagnostic-dir');
368369

369370
if (!signal)
370371
return;
@@ -373,7 +374,7 @@ function initializeHeapSnapshotSignalHandlers() {
373374
const { writeHeapSnapshot } = require('v8');
374375

375376
function doWriteHeapSnapshot() {
376-
writeHeapSnapshot();
377+
writeHeapSnapshot(diagnosticDir ? diagnosticDir + 'heapsnapshot' : null);
377378
}
378379
process.on(signal, doWriteHeapSnapshot);
379380

0 commit comments

Comments
 (0)