Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

The output file -o protocol.csv is not opened with Close-On-Exec semantics #63

Open
konrad-schwarz opened this issue Nov 5, 2021 · 0 comments

Comments

@konrad-schwarz
Copy link

konrad-schwarz commented Nov 5, 2021

In our non-trivial co-simulation setup, a separate (operating system) process is started to perform the simulation. For various reasons, this process is not terminated
immediately after the simulation run.

'csv-compare/Compare' from the modelica-tools then fails to open the output file produced by FmuChecker, because the sub-ordinate process still has an (inherited) open file descriptor to the output file and the file has been opened using the usual Microsoft file locking semantics.

This problem can be solved by marking the file descriptor close-on-exec. In the Win32 API, this is achieved by calling SetHandleInformation on the file descriptor (handle) with the HANDLE_FLAG_INHERIT set in the dwMask parameter and clear in the dwFlags parameter.

See SetHandleInformation. Alternatively, the output file could be opened with more liberal SHARE_DENY settings.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant