Skip to content

Commit 57060b9

Browse files
committed
chore: throwaway macOS probe for beats
1 parent 35cbca9 commit 57060b9

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: dc-beats-probe
2+
on: { push: { branches: [dc/beats-probe] } }
3+
jobs:
4+
probe:
5+
runs-on: macos-latest
6+
steps:
7+
- uses: actions/setup-node@v4
8+
with: { node-version: 22 }
9+
- run: brew install ffmpeg >/dev/null 2>&1 || true; which ffmpeg ffprobe
10+
- uses: actions/checkout@v4
11+
with: { ref: dc/beats-probe, sparse-checkout: .probe }
12+
- name: stand-ins for every developer-tools stub
13+
run: |
14+
mkdir -p "$HOME/stubs"
15+
for t in git xcrun python3 python clang cc gcc make swift swiftc xcodebuild lldb pip3 ld otool; do
16+
printf '#!/bin/sh\necho "STUB $(basename $0) $* (parent: $(ps -o command= -p $PPID))" >> "$HOME/stub.log"\nexit 1\n' > "$HOME/stubs/$t"; chmod +x "$HOME/stubs/$t"
17+
done
18+
- name: beats under the stand-ins
19+
run: |
20+
npm install -g hyperframes@0.9.16 >/dev/null 2>&1
21+
ffmpeg -v error -f lavfi -i "aevalsrc=0.8*sin(2*PI*90*t)*exp(-mod(t,0.5)*25):s=48000:d=8" tone.wav
22+
export PATH="$HOME/stubs:$PATH" SPAWN_LOG="$HOME/spawn.log" NODE_OPTIONS="--require $GITHUB_WORKSPACE/.probe/spawnlog.cjs"
23+
hyperframes beats tone.wav --json; echo "exit=$?"
24+
echo "--- stub calls"; cat "$HOME/stub.log" 2>/dev/null || echo none
25+
echo "--- node spawns"; cat "$HOME/spawn.log" 2>/dev/null || echo none

‎.probe/spawnlog.cjs‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Logs every child process Node starts, with the first frames of who started it.
2+
const cp = require("node:child_process");
3+
const fs = require("node:fs");
4+
const log = (name, file, args) =>
5+
fs.appendFileSync(process.env.SPAWN_LOG, `${process.pid} ${name} ${file} ${JSON.stringify(args ?? [])}\n ${new Error().stack.split("\n").slice(2, 6).join("\n ")}\n`);
6+
for (const name of ["spawn", "spawnSync", "execFile", "execFileSync", "exec", "execSync", "fork"]) {
7+
const real = cp[name];
8+
cp[name] = function (file, args, ...rest) { log(name, file, Array.isArray(args) ? args : []); return real.call(this, file, args, ...rest); };
9+
}

0 commit comments

Comments
 (0)