@@ -33,7 +33,9 @@ extern "C" {
3333#else
3434
3535extern " C" {
36+ #if !defined(__wasm)
3637#include < sys/wait.h>
38+ #endif
3739#include < unistd.h>
3840}
3941
@@ -245,6 +247,7 @@ void File::delete_str_vector (std::vector<char *> &argv) {
245247
246248FILE *File::open_pipe (Internal *internal, const char *fmt,
247249 const char *path, const char *mode) {
250+ #if !defined(__wasm)
248251#ifdef CADICAL_QUIET
249252 (void ) internal;
250253#endif
@@ -269,6 +272,9 @@ FILE *File::open_pipe (Internal *internal, const char *fmt,
269272 FILE *res = popen (cmd, mode);
270273 delete[] cmd;
271274 return res;
275+ #else
276+ return 0 ;
277+ #endif
272278}
273279
274280FILE *File::read_pipe (Internal *internal, const char *fmt, const int *sig,
@@ -285,7 +291,7 @@ FILE *File::read_pipe (Internal *internal, const char *fmt, const int *sig,
285291 return open_pipe (internal, fmt, path, " r" );
286292}
287293
288- #ifndef _WIN32
294+ #if !defined( _WIN32) && !defined(__wasm)
289295
290296#if defined(__APPLE__) || defined(__MACH__)
291297static std::mutex compressed_file_writing_mutex;
@@ -420,7 +426,7 @@ File *File::read (Internal *internal, const char *path) {
420426File *File::write (Internal *internal, const char *path) {
421427 FILE *file;
422428 int close_output = 3 , child_pid = 0 ;
423- #ifndef _WIN32
429+ #if !defined( _WIN32) && !defined(__wasm)
424430 if (has_suffix (path, " .xz" ))
425431 file = write_pipe (internal, " xz -c" , path, child_pid);
426432 else if (has_suffix (path, " .bz2" ))
@@ -456,12 +462,14 @@ void File::close (bool print) {
456462 MSG (" closing file '%s'" , name ());
457463 fclose (file);
458464 }
465+ #if !defined(__wasm)
459466 if (close_file == 2 ) {
460467 if (print)
461468 MSG (" closing input pipe to read '%s'" , name ());
462469 pclose (file);
463470 }
464- #ifndef _WIN32
471+ #endif
472+ #if !defined(_WIN32) && !defined(__wasm)
465473 if (close_file == 3 ) {
466474 if (print)
467475 MSG (" closing output pipe to write '%s'" , name ());
0 commit comments