@@ -265,15 +265,12 @@ async function prepareRemoteRequest(
265265 clientArtifactPaths,
266266 } ) ;
267267
268- if (
269- ! isRemoteDaemon ( info ) ||
270- ( req . command !== 'install' && req . command !== 'reinstall' ) ||
271- positionals . length < 2
272- ) {
268+ if ( ! isRemoteDaemon ( info ) || ( req . command !== 'install' && req . command !== 'reinstall' ) ) {
273269 return baseResult ( ) ;
274270 }
275271
276- const rawPath = positionals [ 1 ] ! ;
272+ const rawPath = positionals [ 1 ] ;
273+ if ( rawPath === undefined ) return baseResult ( ) ;
277274 if ( rawPath . startsWith ( 'remote:' ) ) {
278275 positionals [ 1 ] = rawPath . slice ( 'remote:' . length ) ;
279276 return createPreparedRemoteRequest ( { positionals, flags, clientArtifactPaths } ) ;
@@ -959,7 +956,11 @@ function resolveDaemonLaunchSpec(): DaemonLaunchSpec {
959956 path . join ( root , 'dist' , 'src' , 'internal' , 'daemon.js' ) ,
960957 path . join ( root , 'dist' , 'src' , 'daemon.js' ) ,
961958 ] ;
962- const distPath = distPaths . find ( ( candidate ) => fs . existsSync ( candidate ) ) ?? distPaths [ 0 ] ! ;
959+ const defaultDistPath = distPaths [ 0 ] ;
960+ if ( defaultDistPath === undefined ) {
961+ throw new AppError ( 'COMMAND_FAILED' , 'Daemon dist path list is empty' ) ;
962+ }
963+ const distPath = distPaths . find ( ( candidate ) => fs . existsSync ( candidate ) ) ?? defaultDistPath ;
963964 const srcPath = path . join ( root , 'src' , 'daemon.ts' ) ;
964965
965966 const hasDist = distPaths . some ( ( candidate ) => fs . existsSync ( candidate ) ) ;
0 commit comments