Skip to content

Commit 0cf62ee

Browse files
committed
WIP: Improve proc logging
1 parent 729e94b commit 0cf62ee

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,13 @@ jobs:
6969

7070
- name: Run smoke tests
7171
run: |
72-
ps fx
73-
72+
ps xao pid,ppid,pgid,cmd --forest
73+
7474
if [ "$RUNNER_OS" == "Linux" ]; then
7575
xvfb-run --auto-servernum npm test
7676
else
77-
npm test || true
77+
npm test
7878
fi
79-
80-
ps fx
8179
shell: bash
8280
env:
8381
DEBUG: pw:*

src/index.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const DEV_MODE = process.env.HTK_DEV === 'true';
33
// Set up error handling before everything else:
44
import { logError, addBreadcrumb } from './errors.ts';
55

6-
import { spawn, ChildProcess } from 'child_process';
6+
import { spawn, ChildProcess, execSync } from 'child_process';
77
import * as os from 'os';
88
import { promises as fs, createWriteStream, WriteStream } from 'fs'
99
import * as net from 'net';
@@ -154,6 +154,11 @@ if (!amMainInstance) {
154154
console.log('Failed to kill server', error);
155155
logError(error);
156156
} finally {
157+
// Log at exit
158+
execSync('ps xao pid,ppid,pgid,cmd --forest', {
159+
stdio: 'inherit'
160+
});
161+
157162
if (process.stdin) process.stdin.destroy();
158163
if (process.stdout) process.stdout.destroy();
159164
if (process.stderr) process.stderr.destroy();
@@ -370,6 +375,11 @@ if (!amMainInstance) {
370375
}
371376

372377
async function startServer(retries = 2) {
378+
await delay(100);
379+
execSync('ps xao pid,ppid,pgid,cmd --forest', {
380+
stdio: 'inherit'
381+
});
382+
373383
logStream.write('Starting server\n');
374384
const binName = isWindows ? 'httptoolkit-server.cmd' : 'httptoolkit-server';
375385
const serverBinPath = path.join(RESOURCES_PATH, 'httptoolkit-server', 'bin', binName);

0 commit comments

Comments
 (0)