From cf382736305a6d3358bfb936311a0591fdce5d7b Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 10 May 2019 18:32:05 +0100 Subject: Pipe arguments into command with xargs Prevents broken pipe error --- libpqpp/pq-mock.cpp | 4 ++-- 1 file 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 -- cgit v1.2.3