From 77a405b92f768a22c2fc2201d9fac4408108e741 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 4b5a500adc598e..3cadf1e399e51b 100644 --- a/lib/internal/bootstrap_node.js +++ b/lib/internal/bootstrap_node.js @@ -66,6 +66,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,