On 11/05/10 00:37, David Matthews wrote:
I tried this out under the debugger and found it was actually "ls"
itself that was crashing. I suspect the reason for the difference in
behaviour has to do with differences in the implementation of "/bin/ls"
on different platforms. When calling Posix.Process.exec you have to pass
all the arguments including the first item which is conventionally the
name of the program. So you should always be calling it as
Posix.Process.exec("/bin/ls", ["ls"]);
I seem to recall that this changed in the 5.3 release from previous
releases which included the program name in the argument list
automatically but the Standard Basis library documentation clearly says
that the new implementation is correct. I guess one of the reasons is
that some programs actually do different things when invoked by
different names.

Incidentally, on the machine where Posix.Process.exec("/bin/ls", []) seg. faults, 
Unix.execute("/bin/ls", []) works correctly.  The Basis library documentation I have for 
the Unix structure doesn't discuss how the argv component should be setup, but attempting

  Unix.execute("/bin/ls", ["ls"])

prompts a message from ls saying that there is no file called ls.

This doesn't seem consistent.

Curiously, on the Macbook where Posix.Process.exec gives ENOTSUP, Unix.execute 
does work.

Michael
_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to