From a1feae24cb68ae0db31119c97a83849aaf4c569e Mon Sep 17 00:00:00 2001
From: Cheng Zhao <zcbenz@gmail.com>
Date: Wed, 6 Dec 2023 03:28:17 +0900
Subject: [PATCH] test: resolve path of embedtest binary correctly

PR-URL: https://github.com/nodejs/node/pull/50276
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
---
 test/embedding/test-embedding.js | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/test/embedding/test-embedding.js b/test/embedding/test-embedding.js
index 1fb3bc73f494cb..558ccaee47ff0f 100644
--- a/test/embedding/test-embedding.js
+++ b/test/embedding/test-embedding.js
@@ -14,12 +14,11 @@ tmpdir.refresh();
 common.allowGlobals(global.require);
 common.allowGlobals(global.embedVars);
 
-function resolveBuiltBinary(bin) {
-  let binary = `out/${common.buildType}/${bin}`;
+function resolveBuiltBinary(binary) {
   if (common.isWindows) {
     binary += '.exe';
   }
-  return path.resolve(__dirname, '..', '..', binary);
+  return path.join(path.dirname(process.execPath), binary);
 }
 
 const binary = resolveBuiltBinary('embedtest');