Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when output dir/files exist #10

Open
whophil opened this issue Aug 7, 2016 · 7 comments
Open

Errors when output dir/files exist #10

whophil opened this issue Aug 7, 2016 · 7 comments
Labels

Comments

@whophil
Copy link
Collaborator

whophil commented Aug 7, 2016

Issue by petebachant
Saturday Apr 16, 2016 at 00:34 GMT
Originally opened as https://github.com/whophil/CACTUS-SNL/issues/32


Making a new output dir was a good idea, but it may already exist, and produce errors like

mkdir: cannot create directory ‘output’: File exists
mkdir: cannot create directory ‘output/field’: File exists
mkdir: cannot create directory ‘output/element’: File exists
@whophil
Copy link
Collaborator Author

whophil commented Aug 7, 2016

Comment by whophil
Saturday Apr 16, 2016 at 00:45 GMT


The system call to mkdir does produce errors if the directory exists, but it doesn't halt the code (at least not on my system). If the code continues, I'd say this is more of a warning than an error.

Does the code halt on your system?

@whophil
Copy link
Collaborator Author

whophil commented Aug 7, 2016

Comment by petebachant
Saturday Apr 16, 2016 at 00:47 GMT


Seems like it keeps running. Can we do something like mkdir -p?

@whophil
Copy link
Collaborator Author

whophil commented Aug 7, 2016

Comment by whophil
Saturday Apr 16, 2016 at 00:51 GMT


Unfortunately that would kill Windows compatibility. mkdir exists on Windows but it lacks the -p option. I think I looked briefly into a compiler and platform agnostic way to create directories on Linux/Windows and this was the easiest to implement at the time. There is probably a better way, though...

@whophil
Copy link
Collaborator Author

whophil commented Aug 7, 2016

Comment by petebachant
Saturday Apr 16, 2016 at 01:30 GMT


Ah! Oh well. I will just remove the directory each run.

@whophil
Copy link
Collaborator Author

whophil commented Aug 7, 2016

Comment by whophil
Monday Apr 18, 2016 at 18:05 GMT


I think I see the problem now which arises when you call CACTUS via script and it raises an "Error," potentially halting your script. Of course you could just clean the output directories before you call CACTUS. A more robust solution would be to compile different code bits under different environments using IFDEF statements, and then call the appropriate mkdir commands under each environment.

@whophil
Copy link
Collaborator Author

whophil commented Aug 7, 2016

Comment by whophil
Tuesday Apr 19, 2016 at 03:07 GMT


See whophil@e5cb8da

I haven't had time to test it on Windows or with Intel Fortran, but it works using GFortran on Linux, which I believe is your environment as well.

@whophil
Copy link
Collaborator Author

whophil commented Aug 7, 2016

Comment by petebachant
Tuesday Apr 19, 2016 at 03:37 GMT


Can confirm it works on Linux with GFortran. I don't have an environment setup to compile Fortran on Windows to test though.

@kmruehl kmruehl added the bug label Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants