Changes by: Aleksey Nogin (nogin at metaprl.org)
Date: 2007-06-27 12:33:40 -0700 (Wed, 27 Jun 2007)
Revision: 11148
Log message:
Fixed a nasty hard to debug Windows-specific problem - osh scripts terminated by an "exit" call would always quit with exit code 1, regardless of the actual argument to exit (even if it was "exit 0")!
This was caused by the following:
- Omake_shell had a local "exit" function that would call Omake_readline.save and Omake_shell_sys.close before calling Pervasives.exit
- Omake_shell_sys.close is a no-op on Unix, but under Win32 it would proceed to kill all the currently running processes, _including_ itself!
I fixed this by changing the C code not to kill the current process from omake_shell_sys_close.
This commit also adds some debugging code (protected by "if !debug_shell" in ML and by "#ifdef OSH_DEBUG" in C).