[m-dev.] for review: cleanup of c_modules

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Nov 18 15:56:51 AEDT 1998


On 18-Nov-1998, Peter Ross <petdr at cs.mu.OZ.AU> wrote:
llds_out.m:
> > +:- pred make_directory(string::in, io__state::di, io__state::uo) is det.
> > +
> > +make_directory(DirName) -->
> > +	{ string__format("[ -d %s ] || mkdir -p %s", [s(DirName), s(DirName)],
> > +		Command) },
> > +	io__call_system(Command, _Result).
> >  
> 
> What happens if the mkdir fails?  It would be nice if this predicate
> reported whether or not the mkdir succeded.

That is a good suggestion, but beware that if the compiler is invoked
several times in parallel, then the above system call may fail, even
though the directory does exist by the time the call exits.

So to avoid spurious errors, it should not abort or set io__exit_status.

> I know that you have only moved the above code, but I still think it
> should be fixed.

Agreed; but perhaps not as part of this change.

BTW there is also a very similar routine `make_directory' in modules.m.

--
Fergus Henderson <fjh at cs.mu.oz.au>  |  "Binaries may die
WWW: <http://www.cs.mu.oz.au/~fjh>  |   but source code lives forever"
PGP: finger fjh at 128.250.37.3        |     -- leaked Microsoft memo.



More information about the developers mailing list