From 1557d93a2b0e8c2631ffbe74cb445e4c8da96403 Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Sat, 3 Feb 2018 09:52:29 -0700 Subject: [PATCH] lib: set process.execPath on OpenBSD PR-URL: https://github.com/nodejs/node/pull/18543 Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- lib/internal/bootstrap_node.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js index 2766a8d28d0874..85d72f876124fa 100644 --- a/lib/internal/bootstrap_node.js +++ b/lib/internal/bootstrap_node.js @@ -73,6 +73,13 @@ // URL::ToObject() method is used. NativeModule.require('internal/url'); + // On OpenBSD process.execPath will be relative unless we + // get the full path before process.execPath is used. + if (process.platform === 'openbsd') { + const { realpathSync } = NativeModule.require('fs'); + process.execPath = realpathSync.native(process.execPath); + } + Object.defineProperty(process, 'argv0', { enumerable: true, configurable: false,