11import * as child_process from "node:child_process" ;
2+ import * as fs from "node:fs/promises" ;
23import * as path from "node:path" ;
34import { bsc_exe , rescript_exe } from "#cli/bins" ;
45
@@ -179,8 +180,9 @@ export function setup(cwd = process.cwd()) {
179180 * @param {ExecOptions } [options]
180181 * @return {Promise<ExecResult> }
181182 */
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 ) ;
184186 } ,
185187
186188 /**
@@ -190,8 +192,9 @@ export function setup(cwd = process.cwd()) {
190192 * @param {ExecOptions } [options]
191193 * @return {Promise<ExecResult> }
192194 */
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 ) ;
195198 } ,
196199
197200 /**
@@ -203,8 +206,9 @@ export function setup(cwd = process.cwd()) {
203206 * @param {ExecOptions } [options]
204207 * @return {Promise<ExecResult> }
205208 */
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 ) ;
208212 } ,
209213 } ;
210214}
0 commit comments