[MLton-user] Strange type problem in OS.Process

Dan DuVarney duvarney at reactive-systems.com
Fri Nov 7 13:07:13 PST 2008


Wesley W. Terpstra wrote:
> A couple more quick bits to add:
>   
>> val cmd = "/bin/ls"
>>     
>
> /bin/ls will fail on MinGW. I am guessing you want
> c:/path/to/msys/bin/ls. What you see as /bin doesn't exist for windows
> programs (like the output of MLton). '/' is remapped by bash when you
> execute things from the MinGW shell. Your string constant above
> doesn't get run by bash, but by cmd.exe.
>   
Thanks for the advice. The code was actually not something I wanted to do,
it was just intended to reproduce the error. I guess it's a good thing I
never got to
actually execute the program :-)

>>      if status = OS.Process.failure then
>>     
>
> If this is really all you want to do, "if OS.Process.isSuccess status
> ..." is your best bet. If you really do want to compare status values
> in your larger program, then Posix.Process.fromStatus will get you
> there.
>   
The main thing I want to do is maintain portability of a large
pre-existing code base
between SML/NJ and MLton. Since the SML/NJ basis library we are using
does not
provide OS.Process.isSuccess, it looks to me like a fairly unconvoluted
way of
portably checking exit status is

  (Posix.Process.fromStatus x) <> (Posix.Process.fromStatus
OS.Process.success)

Thanks again for the help.

Dan

-- 
Dan DuVarney
Senior Software Engineer         Reactive Systems Inc.
duvarney at reactive-systems.com    +1 (919) 324-3507 ext. 103
OpenPGP (GnuPG) public key file:
http://www.reactive-systems.com/~duvarney/pgp_public_key.txt




More information about the MLton-user mailing list