> On Nov 5, 2016, at 15:05, David Storrs <[email protected]> wrote:
> 
> I've got this little snip of code:  
> 
> 
> (define p "/tmp/foo/bar-28")
> (file-exists? p)  ; #t
> (delete-file p)
> (file-exists? p)  ; still #t  ??
> 
> 
> I've verified that:
> 
> *) It's not throwing an exception
> *) The code is running as me
> *) The /tmp directory is 777  [I'm on OSX 10.11]
> *) The file itself is 666, although that shouldn't matter
> *) The file is owned by me
> *) p is a string
> *) p points to the correct file
> *) There are no leading or trailing whitespace characters
> *) If I run this code from inside a command-line Racket REPL, it works fine 
> and the file is deleted
> *) If I replace (delete-file) with (system @~a{rm -f @p}) it works fine

Four things occur to me:

1) you say that it works in command-line Racket, but you don’t say where it 
doesn’t work. Is it in the DrR interactions window? As part of a module? Does 
it work if you put it in a module (that is, a file starting with #lang) and run 
it from the command-line?
2) The “-f” in your system command makes me curious. Why should the -f be 
necessary?
3) delete-file is documented to raise an exception if it doesn’t succeed. I’m 
assuming this isn’t happening?
4) In principle, it’s possible that some other process is creating the file 
again between your call to delete-file and the call to file-exists?. Seems 
unlikely, yes. 

John

> 
> I thought maybe there was something weird about the /tmp directory, so I 
> tried putting the target in a different directory 
> (/Users/dstorrs/tmp/foo/bar-28) but that made no difference.
> 
> I've tried googling on the general net and in the mailing list archives and 
> found nothing.  I am utterly flummoxed here; can anyone suggest anything?
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to