tangled
alpha
login
or
join now
tombl.dev
/
dhtml
1
fork
atom
a post-component library for building user-interfaces on the web.
1
fork
atom
overview
issues
pulls
pipelines
Replace execSync with promisified execFile
tombl.dev
7 months ago
80838e88
9c00be40
verified
This commit was signed with the committer's
known signature
.
tombl.dev
SSH Key Fingerprint:
SHA256:d8AHgL5V+3WdvGdDb3SVBfb0RIRJfkKcqhQ5aG1mVNk=
+9
-8
1 changed file
expand all
collapse all
unified
split
scripts
test
main.ts
+9
-8
scripts/test/main.ts
reviewed
···
1
1
import { createBirpc } from 'birpc'
2
2
-
import { execSync } from 'node:child_process'
2
2
+
import { execFile } from 'node:child_process'
3
3
import * as fs from 'node:fs/promises'
4
4
import * as path from 'node:path'
5
5
import { fileURLToPath } from 'node:url'
6
6
-
import { parseArgs, styleText } from 'node:util'
6
6
+
import { parseArgs, promisify, styleText } from 'node:util'
7
7
import { create_browser_runtime } from './browser-runtime.ts'
8
8
import { handle_coverage, type Coverage } from './coverage.ts'
9
9
import * as devalue from './devalue.ts'
···
31
31
})
32
32
33
33
const filter = args.values.filter !== undefined ? new RegExp(args.values.filter) : undefined
34
34
+
const exec_file = promisify(execFile)
34
35
35
36
async function setup_comparison_builds(commits: string[]): Promise<{ paths: string[]; cleanup: () => void }> {
36
37
const build_paths: string[] = []
···
43
44
console.log(`Building version ${i + 1}: ${commit}`)
44
45
45
46
// Create worktree for this commit
46
46
-
execSync(`git worktree add ${temp_dir} ${commit}`, { stdio: 'inherit' })
47
47
+
await exec_file('git', ['worktree', 'add', temp_dir, commit], { stdio: 'inherit' })
47
48
temp_dirs.push(temp_dir)
48
49
49
50
// Build in the worktree
50
50
-
execSync('npm install', { stdio: 'inherit', cwd: temp_dir })
51
51
-
execSync('npm run build', { stdio: 'inherit', cwd: temp_dir })
51
51
+
await exec_file('npm', ['install'], { stdio: 'inherit', cwd: temp_dir })
52
52
+
await exec_file('npm', ['run', 'build'], { stdio: 'inherit', cwd: temp_dir })
52
53
53
54
// Use the dist directory directly from the worktree
54
55
build_paths.push(`${temp_dir}/dist`)
55
56
}
56
57
57
57
-
const cleanup = () => {
58
58
+
const cleanup = async () => {
58
59
// Clean up worktrees
59
60
for (const temp_dir of temp_dirs) {
60
61
try {
61
61
-
execSync(`git worktree remove ${temp_dir}`, { stdio: 'inherit' })
62
62
+
await exec_file('git', ['worktree', 'remove', temp_dir], { stdio: 'inherit' })
62
63
} catch (error) {
63
64
console.warn(`Failed to remove worktree ${temp_dir}:`, error)
64
65
}
···
122
123
// Don't import bench.ts for comparison mode - handled internally
123
124
await client.run_benchmarks({ filter, library_paths })
124
125
} finally {
125
125
-
cleanup()
126
126
+
await cleanup()
126
127
}
127
128
} else {
128
129
// Import bench files for standard mode