Skip to content
This repository was archived by the owner on Oct 17, 2023. It is now read-only.
This repository was 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

Description

@konrad-schwarz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions