X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/d612d62cd04b713bb1057fd2e666365704aaf3d6..8df2e702cf3e5ed9b8433585b357bbcd9f0d623e:/src/domain.sml diff --git a/src/domain.sml b/src/domain.sml index 394bf80..534e440 100644 --- a/src/domain.sml +++ b/src/domain.sml @@ -103,18 +103,6 @@ datatype file_action' = | Delete' of string | Modify' of {src : string, dst : string} -fun shell ss = OS.Process.isSuccess (OS.Process.system (String.concat ss)) - -fun shellF (ss, msg) = - let - val s = String.concat ss - in - if OS.Process.isSuccess (OS.Process.system s) then - () - else - ErrorMsg.error NONE (msg s) - end - fun findDiffs dom = let val realPath = getPath dom Config.resultRoot @@ -136,7 +124,7 @@ fun findDiffs dom = if Posix.FileSys.ST.isDir (Posix.FileSys.stat real) then loopReal acts else if Posix.FileSys.access (tmp, []) then - if shell [Config.diff, " ", real, " ", tmp] then + if Slave.shell [Config.diff, " ", real, " ", tmp] then loopReal acts else loopReal (Modify' {src = tmp, dst = real} :: acts) @@ -146,7 +134,7 @@ fun findDiffs dom = val acts = loopReal [] - val dir = Posix.FileSys.opendir realPath + val dir = Posix.FileSys.opendir tmpPath fun loopTmp acts = case Posix.FileSys.readdir dir of @@ -190,7 +178,7 @@ val _ = Env.container_one "domain" val diffs = findDiffs dom val diffs = map (fn Add' {src, dst} => - (shellF ([Config.cp, " ", src, " ", dst], + (Slave.shellF ([Config.cp, " ", src, " ", dst], fn cl => "Copy failed: " ^ cl); {action = Slave.Add, domain = dom, @@ -203,7 +191,7 @@ val _ = Env.container_one "domain" domain = dom, file = dst}) | Modify' {src, dst} => - (shellF ([Config.cp, " ", src, " ", dst], + (Slave.shellF ([Config.cp, " ", src, " ", dst], fn cl => "Copy failed: " ^ cl); {action = Slave.Modify, domain = dom, @@ -213,7 +201,7 @@ val _ = Env.container_one "domain" () else Slave.handleChanges diffs; - ignore (shellF ([Config.rm, " -rf ", Config.tmpDir, "/*"], + ignore (Slave.shellF ([Config.rm, " -rf ", Config.tmpDir, "/*"], fn cl => "Temp file cleanup failed: " ^ cl)) end)