Skip to content

Commit

Permalink
Stub out a process creation time lookup for macOS.
Browse files Browse the repository at this point in the history
We have an existing utility to look up the creation time of a process,
but the only implementation is for Linux. This has been fine so far, as
Launcher seems to be the only consumer of this API, but the compile-time
guard is now generating issues for us when trying to build that project
on macOS.

So this commit stubs out a macOS implementation that returns an error.
Ideally, we'd actually implement this for macOS, but doing so turns out
to be nontrivial [0] so I don't think it's worth pursing at this time.

[0]: https://stackoverflow.com/questions/31603885/get-process-creation-date-time-in-osx-with-c-c

Signed-off-by: Aaron Jacobs <[email protected]>
  • Loading branch information
atheriel committed Jan 9, 2023
1 parent b7cda61 commit 587c83b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cpp/core/include/core/system/System.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ struct ProcessInfo
std::string state;
std::vector<std::string> arguments;

#if !defined _WIN32 && !defined __APPLE__
#ifndef _WIN32
core::Error creationTime(boost::posix_time::ptime* pCreationTime) const;
#endif
};
Expand Down
5 changes: 5 additions & 0 deletions src/cpp/core/system/PosixSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1955,6 +1955,11 @@ Error processInfo(const std::string& process, std::vector<ProcessInfo>* pInfo, b

return Success();
}

Error ProcessInfo::creationTime(boost::posix_time::ptime* pCreationTime) const
{
return systemError(boost::system::errc::not_supported, ERROR_LOCATION);
}
#endif

std::ostream& operator<<(std::ostream& os, const ProcessInfo& info)
Expand Down

0 comments on commit 587c83b

Please sign in to comment.