File tree 2 files changed +27
-8
lines changed
2 files changed +27
-8
lines changed Original file line number Diff line number Diff line change 5
5
6
6
# More complicated than readlink -f or realpath to support macOS.
7
7
# See https://github.com/cdr/code-server/issues/1537
8
- bin_dir () {
8
+ root_dir () {
9
9
# We read the symlink, which may be relative from $0.
10
10
dst=" $( readlink " $0 " ) "
11
11
# We cd into the $0 directory.
12
12
cd " $( dirname " $0 " ) " || exit 1
13
- # Now we can cd into the dst directory.
14
- cd " $( dirname " $dst " ) " || exit 1
15
- # Finally we use pwd -P to print the absolute path of the directory of $dst.
13
+ # Now we can cd into the directory above the dst directory which is the root
14
+ # of the release.
15
+ cd " $( dirname " $dst " ) /.." || exit 1
16
+ # Finally we use pwd -P to print the absolute path the root.
16
17
pwd -P || exit 1
17
18
}
18
19
19
- BIN_DIR =$( bin_dir )
20
+ ROOT =$( root_dir )
20
21
if [ " $( uname) " = " Linux" ]; then
21
- export LD_LIBRARY_PATH=" $BIN_DIR /../ lib${LD_LIBRARY_PATH+ : $LD_LIBRARY_PATH } "
22
+ export LD_LIBRARY_PATH=" $ROOT / lib:$LD_LIBRARY_PATH "
22
23
elif [ " $( uname) " = " Darwin" ]; then
23
- export DYLD_LIBRARY_PATH=" $BIN_DIR /../ lib${DYLD_LIBRARY_PATH+ : $DYLD_LIBRARY_PATH } "
24
+ export DYLD_LIBRARY_PATH=" $ROOT / lib:$DYLD_LIBRARY_PATH "
24
25
fi
25
- exec " $BIN_DIR /../ lib/node" " $BIN_DIR /.. " " $@ "
26
+ exec " $ROOT / lib/node" " $ROOT " " $@ "
Original file line number Diff line number Diff line change @@ -126,7 +126,25 @@ const main = async (cliArgs: Args): Promise<void> => {
126
126
}
127
127
}
128
128
129
+ function trimLDLibraryPath ( ) : void {
130
+ let ldVar : string
131
+ if ( process . platform === "linux" ) {
132
+ ldVar = "LD_LIBRARY_PATH"
133
+ } else if ( process . platform === "darwin" ) {
134
+ ldVar = "DYLD_LIBRARY_PATH"
135
+ } else {
136
+ return
137
+ }
138
+
139
+ // Removes the leading path added by ./ci/build/code-server.sh to use our bundled
140
+ // dynamic libraries. See ci/build/build-standalone-release.sh
141
+ // This is required to avoid child processes using our bundled libraries.
142
+ process . env [ ldVar ] = process . env [ ldVar ] ?. replace ( path . dirname ( process . execPath ) + ":" , "" )
143
+ }
144
+
129
145
async function entry ( ) : Promise < void > {
146
+ trimLDLibraryPath ( )
147
+
130
148
const tryParse = async ( ) : Promise < Args > => {
131
149
try {
132
150
let args = parse ( process . argv . slice ( 2 ) )
You can’t perform that action at this time.
0 commit comments