Skip to content

Commit

Permalink
Merge pull request #1144 from tpersson/fatalInteractive
Browse files Browse the repository at this point in the history
Flag to throw fatal error when missing file in interactive mode.
  • Loading branch information
tpersson committed Sep 27, 2022
2 parents 9dd099c + 13566ac commit 7a287f4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/latexuguide/control.tex
Expand Up @@ -151,6 +151,7 @@ \section{OPTION}
\hline
\texttt{TELL} & false & prints the current value of all options \\
\texttt{RESET} & false & resets all options to their defaults \\
\texttt{MISSING\_FILE\_FATAL} & false & missing a file triggers a fatal fault. This flag ONLY impacts the INTERACTIVE mode. \\
\hline
\texttt{NO\_FATAL\_STOP} & false & Prevents madx from stopping in case of a fatal error \\
& & \textbf{Use at your own risk !} \\
Expand Down
1 change: 1 addition & 0 deletions src/mad_dict.c
Expand Up @@ -312,6 +312,7 @@ const char *const_command_def =
"update_from_parent = [l, false, true], "
"keep_exp_move = [l, false, true], "
"thin_cf = [l, false, true], "
"missing_file_fatal = [l, false, true], "
"fdstep = [r, 0], " /* ld 07.2020, finite difference step for JACOBIAN and LMDIF */
/* BB and SPCH related options */
"bborbit = [l, false, true], " /* frs */
Expand Down
3 changes: 2 additions & 1 deletion src/mad_stream.c
Expand Up @@ -53,7 +53,8 @@ down_unit(char* file_name)

if ((new = fopen(file_name, "r")) == NULL)
{
if (interactive) warning("cannot open input file:", file_name);
int fatal_missing = get_option("missing_file_fatal"); // only for the interactive mode, in other cases always fatal.
if (interactive && fatal_missing == 0) warning("cannot open input file:", file_name);
else fatal_error("cannot open input file:", file_name);
return 0;
}
Expand Down

0 comments on commit 7a287f4

Please sign in to comment.