Skip to content

Commit 4d22b50

Browse files
committed
fix it finally!!!
1 parent 277edbe commit 4d22b50

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

dev-packages/node-overhead-gh-action/lib/getOverheadMeasurements.mjs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { spawn } from 'child_process';
2+
import { join } from 'path';
23

34
const DEBUG = !!process.env.DEBUG;
45

56
async function getMeasurements(instrumentFile) {
6-
const args = ['./src/app.mjs'];
7+
const curPath = process.cwd();
8+
const args = [join(curPath, './src/app.mjs')];
79

810
if (instrumentFile) {
9-
args.unshift('--import', instrumentFile);
11+
args.unshift('--import', join(curPath, instrumentFile));
1012
}
1113

1214
const cmd = `node ${args.join(' ')}`;
@@ -17,21 +19,18 @@ async function getMeasurements(instrumentFile) {
1719

1820
log('Child process started, waiting for example app...');
1921

20-
appProcess.stderr.on('data', data => {
21-
log(`appProcess stderr: ${data}`);
22-
});
23-
24-
appProcess.on('exit', code => {
25-
log(`appProcess exited with code ${code}`);
26-
});
27-
28-
await new Promise(resolve => {
22+
await new Promise((resolve, reject) => {
2923
appProcess.stdout.on('data', data => {
3024
log(`appProcess: ${data}`);
3125
if (`${data}`.includes('Example app listening on port')) {
3226
resolve();
3327
}
3428
});
29+
30+
appProcess.stderr.on('data', data => {
31+
log(`appProcess stderr: ${data}`);
32+
reject(data);
33+
});
3534
});
3635

3736
log('Example app listening, running autocannon...');

dev-packages/node-overhead-gh-action/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"type": "module",
1010
"main": "index.mjs",
1111
"scripts": {
12+
"dev": "node ./run-local.mjs",
1213
"start": "node ./src/app.mjs",
1314
"start:sentry": "node --import ./src/instrument.mjs ./src/app.mjs",
1415
"start:sentry-error-only": "node --import ./src/instrument-error-only.mjs ./src/app.mjs",

0 commit comments

Comments
 (0)