1616 * Environment variables:
1717 * AGENTCORE_CDK_PATH — absolute path to the agentcore-l3-cdk-constructs repo
1818 */
19- import { execSync } from 'node:child_process' ;
19+ import { execFileSync } from 'node:child_process' ;
2020import * as fs from 'node:fs' ;
2121import * as path from 'node:path' ;
2222import { fileURLToPath } from 'node:url' ;
@@ -31,9 +31,10 @@ function log(msg) {
3131 console . log ( `\n[bundle] ${ msg } ` ) ;
3232}
3333
34- function run ( cmd , opts = { } ) {
35- console . log ( ` > ${ cmd } ` ) ;
36- execSync ( cmd , { stdio : 'inherit' , ...opts } ) ;
34+ function run ( cmd , args = [ ] , opts = { } ) {
35+ const display = [ cmd , ...args ] . join ( ' ' ) ;
36+ console . log ( ` > ${ display } ` ) ;
37+ execFileSync ( cmd , args , { stdio : 'inherit' , ...opts } ) ;
3738}
3839
3940/**
@@ -66,9 +67,9 @@ function resolveCdkPath() {
6667
6768 if ( fs . existsSync ( cloneDir ) ) {
6869 log ( 'Pulling latest changes...' ) ;
69- run ( 'git pull origin main' , { cwd : cloneDir } ) ;
70+ run ( 'git' , [ ' pull' , ' origin' , ' main'] , { cwd : cloneDir } ) ;
7071 } else {
71- run ( ` git clone --depth 1 ${ CDK_REPO_URL } ${ cloneDir } ` ) ;
72+ run ( ' git' , [ ' clone' , ' --depth' , '1' , CDK_REPO_URL , cloneDir ] ) ;
7273 }
7374
7475 return cloneDir ;
0 commit comments