Skip to content

Commit

Permalink
fix env expansion when on web
Browse files Browse the repository at this point in the history
  • Loading branch information
pmp-p committed Jun 17, 2024
1 parent c56e31b commit e31585e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions cibuild/linkweb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ chmod +x placeholder
rm ${PGROOT}/lib/postgresql/utf8_and*.so

# =========================================================


echo
echo 'localhost:5432:postgres:postgres:password' > pgpass
emcc $EMCC_WEB -fPIC -sMAIN_MODULE=1 \
-D__PYDK__=1 -DPREFIX=${PGROOT} \
-sTOTAL_MEMORY=1GB -sSTACK_SIZE=4MB -sALLOW_TABLE_GROWTH -sALLOW_MEMORY_GROWTH -sGLOBAL_BASE=${CMA_MB}MB \
Expand All @@ -131,6 +131,7 @@ emcc $EMCC_WEB -fPIC -sMAIN_MODULE=1 \
--preload-file ${PGROOT}/share/postgresql@${PGROOT}/share/postgresql \
--preload-file ${PGROOT}/lib/postgresql@${PGROOT}/lib/postgresql \
--preload-file ${PGROOT}/password@${PGROOT}/password \
--preload-file pgpass@${PGROOT}/pgpass \
--preload-file placeholder@${PGROOT}/bin/postgres \
--preload-file placeholder@${PGROOT}/bin/initdb \
-o postgres.html $PG_O $PG_L || exit 136
Expand All @@ -148,7 +149,7 @@ cp -v postgres.* ${WEBROOT}/repl/
cp ${PGROOT}/lib/libecpg.so ${WEBROOT}/repl/


cp $GITHUB_WORKSPACE/tests/vtx.js ${WEBROOT}/repl/
cp $GITHUB_WORKSPACE/{tests/vtx.js,patches/Repl.js,patches/repl.html} ${WEBROOT}/repl/
du -hs ${WEBROOT}/repl/*
du -hs ${WEBROOT}/*

Expand Down
1 change: 0 additions & 1 deletion cibuild/pglite-ts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ END
# use a javascript wasm module loader with a thin api for tests
cat ${GITHUB_WORKSPACE}/patches/pgbuild.js > $PGLITE/release/postgres.js
else
cp $PGLITE/release/postgres.js $PGLITE/release/
echo "using emscripten es6->ts interface"
fi

Expand Down
1 change: 1 addition & 0 deletions packages/pglite/src/pglite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export class PGlite implements PGliteInterface {
}

emscriptenOpts = await this.fs!.emscriptenOpts(emscriptenOpts);
console.log("emscriptenOpts:", emscriptenOpts);

// init pg core engine done only using MEMFS
this.emp = await EmPostgresFactory(emscriptenOpts);
Expand Down
5 changes: 3 additions & 2 deletions patches/pg_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,8 @@ main(int argc, char *argv[])
int ret=0;
bool hadloop_error = false;
is_node = !is_web_env();
if (is_node) {

//if (is_node) {
char key[256];
int i=0;
// extra env is always after normal args
Expand Down Expand Up @@ -1027,7 +1028,7 @@ extra_env:;
}
}
puts("\n# =========================================");
}
//}

argv[0] = strdup(WASM_PREFIX "/bin/postgres");

Expand Down

0 comments on commit e31585e

Please sign in to comment.