Skip to content

Commit c451dd6

Browse files
gaearonfacebook-github-bot
authored andcommitted
Update message with instructions
Summary: The middleware for automatically converting Systrace traces to HTML and popping the browser hasn't worked properly for a while, since the version on Homebrew generates some code that uses `Object.observe`, which was deleted from Chrome ages ago. People have complained about it, but fixing it properly has proven to be harder than expected, so I suggest we simply update the message with instructions for people to load it on Chrome, which is what all of us have been doing anyway (AFAIK). Closes #12445 Reviewed By: javache Differential Revision: D4700153 Pulled By: gaearon fbshipit-source-id: 0c33099babed93b3c70d36ae9dfc7d82460c8269
1 parent 14fee73 commit c451dd6

File tree

1 file changed

+7
-30
lines changed

1 file changed

+7
-30
lines changed

local-cli/server/middleware/systraceProfileMiddleware.js

+7-30
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
*/
99
'use strict';
1010

11-
const exec = require('child_process').exec;
1211
const fs = require('fs');
13-
const path = require('path');
1412

1513
module.exports = function(req, res, next) {
1614
if (req.url !== '/systrace') {
@@ -20,33 +18,12 @@ module.exports = function(req, res, next) {
2018

2119
console.log('Dumping profile information...');
2220
var dumpName = '/tmp/dump_' + Date.now() + '.json';
23-
var prefix = process.env.TRACE_VIEWER_PATH || '';
24-
var cmd = path.join(prefix, 'trace2html') + ' ' + dumpName;
2521
fs.writeFileSync(dumpName, req.rawBody);
26-
exec(cmd, function(error) {
27-
if (error) {
28-
if (error.code === 127) {
29-
var response = '\n** Failed executing `' + cmd + '` **\n\n' +
30-
'Google trace-viewer is required to visualize the data, ' +
31-
'You can install it with `brew install trace2html`\n\n' +
32-
'NOTE: Your profile data was kept at:\n' + dumpName;
33-
console.log(response);
34-
res.end(response);
35-
} else {
36-
console.error(error);
37-
res.end('Unknown error: ' + error.message);
38-
}
39-
return;
40-
} else {
41-
exec('rm ' + dumpName);
42-
exec('open ' + dumpName.replace(/json$/, 'html'), function(err) {
43-
if (err) {
44-
console.error(err);
45-
res.end(err.message);
46-
} else {
47-
res.end();
48-
}
49-
});
50-
}
51-
});
22+
var response =
23+
'Your profile was saved at:\n' + dumpName + '\n\n' +
24+
'On Google Chrome navigate to chrome://tracing and then click on "load" ' +
25+
'to load and visualise your profile.\n\n' +
26+
'This message is also printed to your console by the packager so you can copy it :)';
27+
console.log(response);
28+
res.end(response);
5229
};

0 commit comments

Comments
 (0)