Commit f7eba5d2 authored by David Gobbi's avatar David Gobbi Committed by Kitware Robot

Merge topic 'wrappython-fopen'

79fdd73e Retry opening vtkWrapPython output for writing.
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: Andrew Maclean's avatarAndrew Maclean <andrew.amaclean@gmail.com>
Merge-request: !4718
parents 5e107a04 79fdd73e
......@@ -29,6 +29,10 @@
#include <ctype.h>
#include <errno.h>
#ifdef _WIN32
/* for Sleep() */
#include <windows.h>
#endif
/* -------------------------------------------------------------------- */
/* the main entry method, called by vtkParse.y */
......@@ -334,6 +338,20 @@ int main(int argc, char *argv[])
/* get the output file */
fp = fopen(options->OutputFileName, "w");
#ifdef _WIN32
if (!fp)
{
/* repeatedly try to open output file in case of access/sharing error */
/* (for example, antivirus software might be scanning the output file) */
int tries;
for (tries = 0; !fp && tries < 5 && errno == EACCES; tries++)
{
Sleep(1000);
fp = fopen(options->OutputFileName, "w");
}
}
#endif
if (!fp)
{
int e = errno;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment