comparison src/main.mlton.sml @ 1830:d636d33fd8a2

Fix broken implementation of 'urweb daemon stop'
author Austin Seipp <mad.one@gmail.com>
date Wed, 28 Nov 2012 11:39:38 -0500
parents b8fa7441e637
children c3119c263bd3
comparison
equal deleted inserted replaced
1829:aadfc1a138d8 1830:d636d33fd8a2
298 OS.Process.atExit (fn () => OS.FileSys.remove socket); 298 OS.Process.atExit (fn () => OS.FileSys.remove socket);
299 Socket.bind (listen, UnixSock.toAddr socket); 299 Socket.bind (listen, UnixSock.toAddr socket);
300 Socket.listen (listen, 1); 300 Socket.listen (listen, 1);
301 loop () 301 loop ()
302 end) 302 end)
303 303 | ["daemon", "stop"] =>
304 (OS.FileSys.remove socket handle OS.SysErr _ => OS.Process.exit OS.Process.success)
304 | args => 305 | args =>
305 let 306 let
306 val sock = UnixSock.Strm.socket () 307 val sock = UnixSock.Strm.socket ()
307 308
308 fun wait () = 309 fun wait () =
338 send (sock, "\n"); 339 send (sock, "\n");
339 OS.Process.exit (wait ())) 340 OS.Process.exit (wait ()))
340 else 341 else
341 (OS.FileSys.remove socket; 342 (OS.FileSys.remove socket;
342 raise OS.SysErr ("", NONE)) 343 raise OS.SysErr ("", NONE))
343 end handle OS.SysErr _ => case args of 344 end handle OS.SysErr _ => OS.Process.exit (oneRun args)
344 ["daemon", "stop"] => (OS.FileSys.remove socket handle OS.SysErr _ => ())
345 | _ => OS.Process.exit (oneRun args)