@@ -5,7 +5,7 @@ import * as os from 'node:os';
5
5
import * as path from 'node:path' ;
6
6
import * as url from 'node:url' ;
7
7
8
- import { localRepoPath } from './utils' ;
8
+ import { exec , execOutput , localRepoPath } from './utils' ;
9
9
10
10
const NS_PER_SEC = 1e9 ;
11
11
const LOCAL = 'local' ;
@@ -25,15 +25,6 @@ function runBenchmarks() {
25
25
}
26
26
}
27
27
28
- function exec ( command : string , options = { } ) {
29
- const result = cp . execSync ( command , {
30
- encoding : 'utf-8' ,
31
- stdio : [ 'inherit' , 'pipe' , 'inherit' ] ,
32
- ...options ,
33
- } ) ;
34
- return result ?. trimEnd ( ) ;
35
- }
36
-
37
28
interface BenchmarkProject {
38
29
revision : string ;
39
30
projectPath : string ;
@@ -86,7 +77,7 @@ function prepareBenchmarkProjects(
86
77
}
87
78
88
79
// Returns the complete git hash for a given git revision reference.
89
- const hash = exec ( `git rev-parse "${ revision } "` ) ;
80
+ const hash = execOutput ( `git rev-parse "${ revision } "` ) ;
90
81
91
82
const archivePath = path . join ( tmpDir , `graphql-${ hash } .tgz` ) ;
92
83
if ( fs . existsSync ( archivePath ) ) {
@@ -108,7 +99,9 @@ function prepareBenchmarkProjects(
108
99
exec ( 'npm --quiet run build:npm' , { cwd : repoDir } ) ;
109
100
110
101
const distDir = path . join ( repoDir , 'npmDist' ) ;
111
- const archiveName = exec ( `npm --quiet pack ${ distDir } ` , { cwd : repoDir } ) ;
102
+ const archiveName = execOutput ( `npm --quiet pack ${ distDir } ` , {
103
+ cwd : repoDir ,
104
+ } ) ;
112
105
return path . join ( repoDir , archiveName ) ;
113
106
}
114
107
}
0 commit comments