1
1
import * as child_process from "node:child_process" ;
2
+ import * as fs from "node:fs/promises" ;
2
3
import * as path from "node:path" ;
3
4
import { bsc_exe , rescript_exe } from "#cli/bins" ;
4
5
@@ -179,8 +180,9 @@ export function setup(cwd = process.cwd()) {
179
180
* @param {ExecOptions } [options]
180
181
* @return {Promise<ExecResult> }
181
182
*/
182
- execBuild ( args = [ ] , options = { } ) {
183
- return exec ( rescript_exe , [ "build" , ...args ] , options ) ;
183
+ async execBuild ( args = [ ] , options = { } ) {
184
+ const realPath = await fs . realpath ( rescript_exe ) ;
185
+ return exec ( realPath , [ "build" , ...args ] , options ) ;
184
186
} ,
185
187
186
188
/**
@@ -190,8 +192,9 @@ export function setup(cwd = process.cwd()) {
190
192
* @param {ExecOptions } [options]
191
193
* @return {Promise<ExecResult> }
192
194
*/
193
- execClean ( args = [ ] , options = { } ) {
194
- return exec ( rescript_exe , [ "clean" , ...args ] , options ) ;
195
+ async execClean ( args = [ ] , options = { } ) {
196
+ const realPath = await fs . realpath ( rescript_exe ) ;
197
+ return exec ( realPath , [ "clean" , ...args ] , options ) ;
195
198
} ,
196
199
197
200
/**
@@ -203,8 +206,9 @@ export function setup(cwd = process.cwd()) {
203
206
* @param {ExecOptions } [options]
204
207
* @return {Promise<ExecResult> }
205
208
*/
206
- execBin ( bin , args = [ ] , options = { } ) {
207
- return exec ( bin , args , options ) ;
209
+ async execBin ( bin , args = [ ] , options = { } ) {
210
+ const realPath = await fs . realpath ( bin ) ;
211
+ return exec ( realPath , args , options ) ;
208
212
} ,
209
213
} ;
210
214
}
0 commit comments