diff options
author | 2015-11-22 10:03:35 -0500 | |
---|---|---|
committer | 2015-11-22 10:03:35 -0500 | |
commit | deb89707754afa4caab231ca3b98764e6d695a3b (patch) | |
tree | 406ee5a2ccbaa50a1c654156d6da525c78af3245 /src/main.mlton.sml | |
parent | 736665b9b6975af4dbb3f68cec31fb75d77915f2 (diff) |
Make daemon mode support sharing of libraries across projects
Diffstat (limited to 'src/main.mlton.sml')
-rw-r--r-- | src/main.mlton.sml | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/main.mlton.sml b/src/main.mlton.sml index bfc18e59..7197babf 100644 --- a/src/main.mlton.sml +++ b/src/main.mlton.sml @@ -279,19 +279,25 @@ val () = case CommandLine.arguments () of in case cmd of "" => - let - val success = (oneRun (rev args)) - handle ex => (print "unhandled exception:\n"; - print (General.exnMessage ex ^ "\n"); - OS.Process.failure) - in - TextIO.flushOut TextIO.stdOut; - TextIO.flushOut TextIO.stdErr; - send (sock, if OS.Process.isSuccess success then - "\001" - else - "\002") - end + (case args of + ["stop", "daemon"] => + (((Socket.close listen; + OS.FileSys.remove socket) handle OS.SysErr _ => ()); + OS.Process.exit OS.Process.success) + | _ => + let + val success = (oneRun (rev args)) + handle ex => (print "unhandled exception:\n"; + print (General.exnMessage ex ^ "\n"); + OS.Process.failure) + in + TextIO.flushOut TextIO.stdOut; + TextIO.flushOut TextIO.stdErr; + send (sock, if OS.Process.isSuccess success then + "\001" + else + "\002") + end) | _ => loop' (rest, cmd :: args) end end handle OS.SysErr _ => () @@ -315,6 +321,7 @@ val () = case CommandLine.arguments () of Posix.IO.close oldStdout; Posix.IO.close oldStderr; + Settings.reset (); MLton.GC.pack (); loop () end @@ -324,8 +331,6 @@ val () = case CommandLine.arguments () of Socket.listen (listen, 1); loop () end) - | ["daemon", "stop"] => - (OS.FileSys.remove socket handle OS.SysErr _ => OS.Process.exit OS.Process.success) | args => let val sock = UnixSock.Strm.socket () |