Skip to content

Commit 6c55ae1

Browse files
authored
Skip system call during dbinit
* although <some> syscalls are supported by emscripten, this is not what we (always) want. in this particular case, initdb is querying the server configuration by executing postgres with various parameters. when running on node, the calls end up trying to execute on the OS, which leads to a series of errors and undesirable behavior. instead, these syscalls should remain inside the wasm sandbox somehow. until we decide on a proper way to do this, the initdb querying of postgres server configs will just fail (which is the case anyhow atm).
1 parent c026976 commit 6c55ae1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/bin/initdb/initdb.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,14 @@ test_specific_config_settings(int test_conns, int test_buffs)
12451245
DEVNULL, DEVNULL);
12461246

12471247
fflush(NULL);
1248+
#if defined(__EMSCRIPTEN__)
1249+
// emscripten supports (some?) syscalls, but that's not actually what we want, because we want to remain inside the wasm sandbox
1250+
// so just return a dummy value until we decide how to handle syscalls.
1251+
// TODO: https://github.com/electric-sql/pglite/issues/798
1252+
status = 123;
1253+
#else
12481254
status = system(cmd.data);
1255+
#endif // #if defined(__EMSCRIPTEN__)
12491256

12501257
termPQExpBuffer(&cmd);
12511258

0 commit comments

Comments
 (0)