summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-05-10 18:32:05 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2019-05-10 18:32:05 +0100
commitcf382736305a6d3358bfb936311a0591fdce5d7b (patch)
tree80d269e1382f0b201ec0b6ff232ba4f44077ba75
parentCreate hasUnloggedTables, like hasCopyToProgram (diff)
downloadlibdbpp-postgresql-cf382736305a6d3358bfb936311a0591fdce5d7b.tar.bz2
libdbpp-postgresql-cf382736305a6d3358bfb936311a0591fdce5d7b.tar.xz
libdbpp-postgresql-cf382736305a6d3358bfb936311a0591fdce5d7b.zip
Pipe arguments into command with xargs
Prevents broken pipe error
-rw-r--r--libpqpp/pq-mock.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libpqpp/pq-mock.cpp b/libpqpp/pq-mock.cpp
index f0e90ea..018dad4 100644
--- a/libpqpp/pq-mock.cpp
+++ b/libpqpp/pq-mock.cpp
@@ -86,11 +86,11 @@ Mock::hasCopyToProgram() const
return (serverVersion >= 90300);
}
-AdHocFormatter(MockCreateTablespaceDir, "COPY (SELECT 1) TO PROGRAM 'mkdir -p %?'");
+AdHocFormatter(MockCreateTablespaceDir, "COPY (SELECT '%?') TO PROGRAM 'xargs mkdir -p'");
AdHocFormatter(MockCreateTablespace, "CREATE TABLESPACE %? LOCATION '%?'");
AdHocFormatter(MockCreateDatabase, "CREATE DATABASE %? TABLESPACE %?");
AdHocFormatter(MockDropTablespace, "DROP TABLESPACE IF EXISTS %?");
-AdHocFormatter(MockDropTablespaceDir, "COPY (SELECT 1) TO PROGRAM 'rm -rf %?'");
+AdHocFormatter(MockDropTablespaceDir, "COPY (SELECT '%?') TO PROGRAM 'xargs rm -rf'");
void
Mock::CreateNewDatabase() const