X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/99cc41443c07f97535eaeecc628d99075ca2cebf..611f7186fc07bd57346bdd31eee16f9c0a5d273a:/src/plugins/postgres.sml diff --git a/src/plugins/postgres.sml b/src/plugins/postgres.sml index 09e3a07..f80fcea 100644 --- a/src/plugins/postgres.sml +++ b/src/plugins/postgres.sml @@ -21,24 +21,18 @@ structure Postgres :> POSTGRES = struct fun adduser {user, passwd} = - if Slave.shell [Config.Postgres.adduser, user] then - NONE - else - SOME "Error executing CREATE USER script" + Option.map (fn s => "Error executing CREATE USER script:\n" ^ s) + (Slave.shellOutput [Config.Postgres.adduser, user]) fun passwd _ = SOME "We don't use PostgreSQL passwords." fun createdb {user, dbname} = - if Slave.shell [Config.Postgres.createdb, user, " ", dbname] then - NONE - else - SOME "Error executing CREATE DATABASE script" + Option.map (fn s => "Error executing CREATE DATABASE script:\n" ^ s) + (Slave.shellOutput [Config.Postgres.createdb, user, " ", dbname]) fun dropdb {user, dbname} = - if Slave.shell [Config.Postgres.dropdb, user, " ", dbname] then - NONE - else - SOME "Error executing DROP DATABASE script" + Option.map (fn s => "Error executing DROP DATABASE script:\n" ^ s) + (Slave.shellOutput [Config.Postgres.dropdb, user, " ", dbname]) val _ = Dbms.register ("postgres", {getpass = NONE, adduser = adduser,