Skip to content

Commit ffd41b1

Browse files
committed
linux condition
Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
1 parent 67ecb3f commit ffd41b1

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

bazel/tcl_library_init.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
#if TCL_MAJOR_VERSION >= 9 && !defined(USE_TCL_RUNFILE_INIT)
1616
#include "bazel/tcl_resources_zip_data.h"
1717
#else
18+
#ifdef __linux__
1819
#include <linux/limits.h>
1920
#include <unistd.h>
21+
#endif
2022

2123
#include <memory>
2224

@@ -41,10 +43,14 @@ static std::optional<std::string> TclLibraryMountPoint(Tcl_Interp* interp)
4143
std::string error;
4244
// Use /proc/self/exe to resolve the real binary path, as argv[0] may
4345
// point into a sandbox where the .runfiles tree does not exist.
46+
#ifdef __linux__
4447
char buf[PATH_MAX + 1];
4548
ssize_t len = readlink("/proc/self/exe", buf, PATH_MAX);
4649
std::string exe_path = (len > 0) ? std::string(buf, len)
4750
: std::string(Tcl_GetNameOfExecutable());
51+
#else
52+
std::string exe_path(Tcl_GetNameOfExecutable());
53+
#endif
4854
std::unique_ptr<Runfiles> runfiles(
4955
Runfiles::Create(exe_path, BAZEL_CURRENT_REPOSITORY, &error));
5056
if (!runfiles) {

0 commit comments

Comments
 (0)