@@ -182,7 +182,7 @@ describe("WSL runtime cache", () => {
182182
183183 expect ( script ) . toContain ( 'runtime_parent="$HOME/.t3/wsl-runtime"' ) ;
184184 expect ( script ) . toContain ( ' [ -f "$ready_marker" ] &&' ) ;
185- expect ( script ) . toContain ( ' runtime_entry_runs "$runtime_root" &&' ) ;
185+ expect ( script ) . toContain ( ' runtime_entry_runs "$runtime_root" 2>/dev/null &&' ) ;
186186 expect ( script ) . toContain ( "if runtime_is_ready; then" ) ;
187187 expect ( script ) . not . toContain ( "bin.mjs" ) ;
188188 expect ( script ) . not . toContain ( "node-pty" ) ;
@@ -262,7 +262,7 @@ describe("WSL runtime cache", () => {
262262 "b" . repeat ( 64 ) ,
263263 ) ;
264264
265- expect ( script ) . toContain ( ' [ -x "$1/t3" ] && "$1/t3" --version >/dev/null 2>&1 ' ) ;
265+ expect ( script ) . toContain ( ' [ -x "$1/t3" ] && "$1/t3" --version >/dev/null' ) ;
266266
267267 const entryCheckDefined = script . indexOf ( "runtime_entry_runs() {" ) ;
268268 const readinessDefined = script . indexOf ( "runtime_is_ready() {" ) ;
@@ -374,14 +374,14 @@ describe.skipIf(posixShellRunner === null)("WSL runtime install script (executed
374374 fixtures . length = 0 ;
375375 } ) ;
376376
377- const createFixture = ( ) => {
377+ const createFixture = ( serverEntry = SERVER_ENTRY_SOURCE ) => {
378378 const result = runShell (
379379 [
380380 "set -eu" ,
381381 "work=$(mktemp -d)" ,
382382 'stage="$work/stage/t3-0.0.0-linux-x64"' ,
383383 'mkdir -p "$stage/node_modules/node-pty/build/Release" "$work/home"' ,
384- `printf '%s' ${ sh ( SERVER_ENTRY_SOURCE ) } > "$stage/t3"` ,
384+ `printf '%s' ${ sh ( serverEntry ) } > "$stage/t3"` ,
385385 'chmod +x "$stage/t3"' ,
386386 `printf '%s' 'pty-native-payload' > "$stage/node_modules/node-pty/build/Release/pty.node"` ,
387387 `tar -czf "$work/wsl-runtime.tar.gz" -C "$work/stage" t3-0.0.0-linux-x64` ,
@@ -495,6 +495,18 @@ describe.skipIf(posixShellRunner === null)("WSL runtime install script (executed
495495 expect ( parseWslRuntimeRoot ( warm . stdout ) ) . toBe ( fixture . runtimeRoot ) ;
496496 } ) ;
497497
498+ it ( "retains the loader error when a bundled executable needs a missing system library" , ( ) => {
499+ const fixture = createFixture (
500+ '#!/bin/sh\nprintf "error while loading shared libraries: libatomic.so.1: cannot open shared object file\\n" >&2\nexit 127\n' ,
501+ ) ;
502+
503+ const result = fixture . install ( ) ;
504+
505+ expect ( result . status ) . not . toBe ( 0 ) ;
506+ expect ( result . stderr ) . toContain ( "libatomic.so.1" ) ;
507+ expect ( parseWslRuntimeRoot ( result . stdout ) ) . toBeNull ( ) ;
508+ } ) ;
509+
498510 it ( "reinstalls a cache whose executable was truncated" , ( ) => {
499511 const fixture = createFixture ( ) ;
500512 expect ( fixture . install ( ) . status ) . toBe ( 0 ) ;
0 commit comments