Skip to content

Commit b6001a2

Browse files
committed
src: make SIGPROF message a real warning
This commit replaces a fprintf() with a call to ProcessEmitWarning(). Refs: #12706 PR-URL: #12709 Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 9ce2271 commit b6001a2

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/signal_wrap.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ class SignalWrap : public HandleWrap {
9292
if (signum == SIGPROF) {
9393
Environment* env = Environment::GetCurrent(args);
9494
if (env->inspector_agent()->IsStarted()) {
95-
fprintf(stderr, "process.on(SIGPROF) is reserved while debugging\n");
95+
ProcessEmitWarning(env,
96+
"process.on(SIGPROF) is reserved while debugging");
9697
return;
9798
}
9899
}

test/parallel/test-warn-sigprof.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use strict';
2+
const common = require('../common');
3+
4+
// The inspector attempts to start when Node starts. Once started, the inspector
5+
// warns on the use of a SIGPROF listener.
6+
7+
common.skipIfInspectorDisabled();
8+
9+
if (common.isWindows) {
10+
common.skip('test does not apply to Windows');
11+
return;
12+
}
13+
14+
common.expectWarning('Warning',
15+
'process.on(SIGPROF) is reserved while debugging');
16+
17+
process.on('SIGPROF', () => {});

0 commit comments

Comments
 (0)