@@ -109,6 +109,37 @@ it.layer(NodeServices.layer)("root CLI commands", (it) => {
109109 } ) ,
110110 ) . toBe ( "sudo /opt/t3/t3 browser setup" ) ;
111111
112+ // A standalone executable started directly (systemd, no launcher) is still this install.
113+ expect (
114+ yield * rootCommand ( {
115+ node : "/opt/t3/t3" ,
116+ entry : "/opt/t3/t3" ,
117+ executable : true ,
118+ path : yield * pathWithT3 ,
119+ } ) ,
120+ ) . toBe ( "sudo /opt/t3/t3 browser setup" ) ;
121+
122+ // A global npm launcher runs the downloaded executable; PATH's `t3` is that launcher.
123+ const prefix = path . join ( home , "npm" ) ;
124+ const npmLauncher = path . join ( prefix , "lib/node_modules/t3/bin/t3.mjs" ) ;
125+ yield * fs . makeDirectory ( path . dirname ( npmLauncher ) , { recursive : true } ) ;
126+ yield * fs . makeDirectory ( path . join ( prefix , "bin" ) ) ;
127+ yield * fs . writeFileString ( npmLauncher , "" , { mode : 0o755 } ) ;
128+ yield * fs . writeFileString (
129+ path . join ( prefix , "lib/node_modules/t3/package.json" ) ,
130+ `{"name":"t3","version":"${ packageJson . version } "}` ,
131+ ) ;
132+ yield * fs . symlink ( npmLauncher , path . join ( prefix , "bin/t3" ) ) ;
133+ expect (
134+ yield * rootCommand ( {
135+ node : "/home/theo/.t3/runtime/versions/1.0.0/t3" ,
136+ entry : "/home/theo/.t3/runtime/versions/1.0.0/t3" ,
137+ executable : true ,
138+ path : path . join ( prefix , "bin" ) ,
139+ env : { T3CODE_NPM_LAUNCHER_PATH : npmLauncher } ,
140+ } ) ,
141+ ) . toBe ( 'sudo env "PATH=$PATH" t3 browser setup' ) ;
142+
112143 expect (
113144 yield * rootCommand ( { ...desktop , env : { T3CODE_CLI_PATH : path . join ( home , "gone" ) } } ) ,
114145 ) . toBe ( 'sudo env "PATH=$PATH" t3 browser setup' ) ;
0 commit comments