-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trace_events: stop tracing agent in process.exit()
PR-URL: #18005 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
- Loading branch information
1 parent
acf56be
commit 6aac05b
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const cp = require('child_process'); | ||
const fs = require('fs'); | ||
|
||
const FILE_NAME = 'node_trace.1.log'; | ||
|
||
common.refreshTmpDir(); | ||
process.chdir(common.tmpDir); | ||
|
||
const proc = cp.spawn(process.execPath, | ||
[ '--trace-events-enabled', | ||
'-e', 'process.exit()' ]); | ||
|
||
proc.once('exit', common.mustCall(() => { | ||
assert(common.fileExists(FILE_NAME)); | ||
fs.readFile(FILE_NAME, common.mustCall((err, data) => { | ||
const traces = JSON.parse(data.toString()).traceEvents; | ||
assert(traces.length > 0); | ||
})); | ||
})); |