Skip to content

Commit

Permalink
internal: add custom dir support for heapsnapshot-signal
Browse files Browse the repository at this point in the history
  • Loading branch information
MrJithil committed May 4, 2023
1 parent 9e5e2f1 commit 18d913b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/internal/process/pre_execution.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ function initializeReportSignalHandlers() {

function initializeHeapSnapshotSignalHandlers() {
const signal = getOptionValue('--heapsnapshot-signal');
const diagnosticDir = getOptionValue('--diagnostic-dir');

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

function doWriteHeapSnapshot() {
writeHeapSnapshot();
writeHeapSnapshot(diagnosticDir ? diagnosticDir + 'heapsnapshot' : null);
}
process.on(signal, doWriteHeapSnapshot);

Expand Down

0 comments on commit 18d913b

Please sign in to comment.