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
@@ -168,8 +169,9 @@ export function setup(cwd = process.cwd()) {
168169 * @param {ExecOptions } [options]
169170 * @return {Promise<ExecResult> }
170171 */
171- bsc ( args = [ ] , options = { } ) {
172- return exec ( bsc_exe , args , options ) ;
172+ async bsc ( args = [ ] , options = { } ) {
173+ const realPath = await fs . realpath ( bsc_exe ) ;
174+ return exec ( realPath , args , options ) ;
173175 } ,
174176
175177 /**
@@ -179,8 +181,9 @@ export function setup(cwd = process.cwd()) {
179181 * @param {ExecOptions } [options]
180182 * @return {Promise<ExecResult> }
181183 */
182- execBuild ( args = [ ] , options = { } ) {
183- return exec ( rescript_exe , [ "build" , ...args ] , options ) ;
184+ async execBuild ( args = [ ] , options = { } ) {
185+ const realPath = await fs . realpath ( rescript_exe ) ;
186+ return exec ( realPath , [ "build" , ...args ] , options ) ;
184187 } ,
185188
186189 /**
@@ -190,8 +193,9 @@ export function setup(cwd = process.cwd()) {
190193 * @param {ExecOptions } [options]
191194 * @return {Promise<ExecResult> }
192195 */
193- execClean ( args = [ ] , options = { } ) {
194- return exec ( rescript_exe , [ "clean" , ...args ] , options ) ;
196+ async execClean ( args = [ ] , options = { } ) {
197+ const realPath = await fs . realpath ( rescript_exe ) ;
198+ return exec ( realPath , [ "clean" , ...args ] , options ) ;
195199 } ,
196200
197201 /**
@@ -203,8 +207,9 @@ export function setup(cwd = process.cwd()) {
203207 * @param {ExecOptions } [options]
204208 * @return {Promise<ExecResult> }
205209 */
206- execBin ( bin , args = [ ] , options = { } ) {
207- return exec ( bin , args , options ) ;
210+ async execBin ( bin , args = [ ] , options = { } ) {
211+ const realPath = await fs . realpath ( bin ) ;
212+ return exec ( realPath , args , options ) ;
208213 } ,
209214 } ;
210215}
0 commit comments