Skip to content

Commit 30adc7c

Browse files
authored
src: fix --build-sea default executable path
PR-URL: #61708 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
1 parent 551f605 commit 30adc7c

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

src/node_sea_bin.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ ExitCode BuildSingleExecutable(const std::string& sea_config_path,
388388

389389
SeaConfig config = opt_config.value();
390390
if (config.executable_path.empty()) {
391-
config.executable_path = args[0];
391+
config.executable_path = Environment::GetExecPath(args);
392392
}
393393

394394
// Get file permissions from source executable to copy over later.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
'use strict';
2+
// This tests --build-sea with a custom argv0 value.
3+
4+
require('../common');
5+
6+
const { skipIfBuildSEAIsNotSupported } = require('../common/sea');
7+
8+
skipIfBuildSEAIsNotSupported();
9+
10+
const tmpdir = require('../common/tmpdir');
11+
const fixtures = require('../common/fixtures');
12+
const { copyFileSync } = require('fs');
13+
14+
const { spawnSyncAndAssert } = require('../common/child_process');
15+
tmpdir.refresh();
16+
17+
copyFileSync(
18+
fixtures.path('sea', 'basic', 'sea-config.json'),
19+
tmpdir.resolve('sea-config.json'),
20+
);
21+
22+
copyFileSync(
23+
fixtures.path('sea', 'basic', 'sea.js'),
24+
tmpdir.resolve('sea.js'),
25+
);
26+
27+
spawnSyncAndAssert(
28+
process.execPath,
29+
['--build-sea', tmpdir.resolve('sea-config.json')], {
30+
cwd: tmpdir.path,
31+
argv0: 'argv0',
32+
}, {
33+
stdout: /Generated single executable/,
34+
});

0 commit comments

Comments
 (0)