Skip to content

Commit 9a879f5

Browse files
committed
fix(std/wrap): fix libraryPath merging
1 parent d0a391c commit 9a879f5

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

packages/std/wrap.tg.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -917,14 +917,12 @@ const manifestInterpreterFromWrapArgObject = async (
917917
// If this is not a "normal" interpreter run the library path optimization, including any additional paths from the user.
918918
if (interpreter.kind !== "normal") {
919919
const { executable, libraryPaths, libraryPathStrategy } = arg;
920-
if (executable) {
921-
interpreter = await optimizeLibraryPaths({
922-
executable,
923-
interpreter,
924-
libraryPaths,
925-
libraryPathStrategy,
926-
});
927-
}
920+
interpreter = await optimizeLibraryPaths({
921+
executable,
922+
interpreter,
923+
libraryPaths,
924+
libraryPathStrategy,
925+
});
928926
}
929927

930928
return manifestInterpreterFromWrapInterpreter(interpreter);
@@ -1263,7 +1261,7 @@ const interpreterFromElf = async (
12631261
};
12641262

12651263
type OptimizeLibraryPathsArg = {
1266-
executable: string | tg.Template | tg.File | tg.Symlink;
1264+
executable?: string | tg.Template | tg.File | tg.Symlink | undefined;
12671265
interpreter:
12681266
| wrap.DyLdInterpreter
12691267
| wrap.LdLinuxInterpreter
@@ -1318,17 +1316,21 @@ const optimizeLibraryPaths = async (
13181316
}
13191317

13201318
// Prepare to map needed libraries to their locations.
1321-
let neededLibraries = await getInitialNeededLibraries(executable);
1319+
let neededLibraries = executable
1320+
? await getInitialNeededLibraries(executable)
1321+
: new Map();
13221322

13231323
// Produce a set of the available library paths as directories with optional subpaths.
13241324
const libraryPathSet = await createLibraryPathSet(paths);
13251325

13261326
// Find any transitively needed libraries in the set and record their location.
1327-
neededLibraries = await findTransitiveNeededLibraries(
1328-
executable,
1329-
libraryPathSet,
1330-
neededLibraries,
1331-
);
1327+
neededLibraries = executable
1328+
? await findTransitiveNeededLibraries(
1329+
executable,
1330+
libraryPathSet,
1331+
neededLibraries,
1332+
)
1333+
: new Map();
13321334

13331335
// All optimization strategies required filtering first.
13341336
const filtereredNeededLibraries: Map<string, DirWithSubpath> = new Map();

0 commit comments

Comments
 (0)