aboutsummaryrefslogtreecommitdiff
path: root/svg-flatten/src/util.cpp
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2021-08-29 16:27:23 +0200
committerjaseg <git@jaseg.de>2021-09-29 16:37:59 +0200
commit7eb0b9d7e42a20b85bd7afbfe3d33d9dd5fa5794 (patch)
tree5ac1f274b0c933234535c6b8f19a8d270f9e2d83 /svg-flatten/src/util.cpp
parentc58b6573f2a0694c0c1942e7c36704e0517ced19 (diff)
downloadgerbolyze-7eb0b9d7e42a20b85bd7afbfe3d33d9dd5fa5794.tar.gz
gerbolyze-7eb0b9d7e42a20b85bd7afbfe3d33d9dd5fa5794.tar.bz2
gerbolyze-7eb0b9d7e42a20b85bd7afbfe3d33d9dd5fa5794.zip
svg-flatten: Add wasmtime support
Diffstat (limited to 'svg-flatten/src/util.cpp')
-rw-r--r--svg-flatten/src/util.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/svg-flatten/src/util.cpp b/svg-flatten/src/util.cpp
index e88f4e9..d9a5a09 100644
--- a/svg-flatten/src/util.cpp
+++ b/svg-flatten/src/util.cpp
@@ -1,16 +1,19 @@
-#include <pwd.h>
#include <sys/types.h>
#include <string>
#include <iostream>
+#ifndef NOFORK
+#include <pwd.h>
#include <subprocess.h>
+#endif
#include <filesystem>
#include "util.h"
using namespace std;
+#ifndef NOFORK
int gerbolyze::run_cargo_command(const char *cmd_name, const char *cmdline[], const char *envvar) {
const char *homedir;
if ((homedir = getenv("HOME")) == NULL) {
@@ -81,4 +84,11 @@ int gerbolyze::run_cargo_command(const char *cmd_name, const char *cmdline[], co
return 0;
}
+#else
+int gerbolyze::run_cargo_command(const char *cmd_name, const char *cmdline[], const char *envvar) {
+ (void) cmd_name, (void) cmdline, (void) envvar;
+ cerr << "Error: Cannot spawn " << cmd_name << " subprocess since binary was built with fork/exec disabled (-DNOFORK=1)" << endl;
+ return EXIT_FAILURE;
+}
+#endif