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
@@ -168,8 +169,9 @@ export function setup(cwd = process.cwd()) {
168
169
* @param {ExecOptions } [options]
169
170
* @return {Promise<ExecResult> }
170
171
*/
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 ) ;
173
175
} ,
174
176
175
177
/**
@@ -179,8 +181,9 @@ export function setup(cwd = process.cwd()) {
179
181
* @param {ExecOptions } [options]
180
182
* @return {Promise<ExecResult> }
181
183
*/
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 ) ;
184
187
} ,
185
188
186
189
/**
@@ -190,8 +193,9 @@ export function setup(cwd = process.cwd()) {
190
193
* @param {ExecOptions } [options]
191
194
* @return {Promise<ExecResult> }
192
195
*/
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 ) ;
195
199
} ,
196
200
197
201
/**
@@ -203,8 +207,9 @@ export function setup(cwd = process.cwd()) {
203
207
* @param {ExecOptions } [options]
204
208
* @return {Promise<ExecResult> }
205
209
*/
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 ) ;
208
213
} ,
209
214
} ;
210
215
}
0 commit comments