Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/node_sea_bin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ ExitCode BuildSingleExecutable(const std::string& sea_config_path,

SeaConfig config = opt_config.value();
if (config.executable_path.empty()) {
config.executable_path = args[0];
config.executable_path = Environment::GetExecPath(args);
}

// Get file permissions from source executable to copy over later.
Expand Down
34 changes: 34 additions & 0 deletions test/sea/test-build-sea-custom-argv0.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'use strict';
// This tests --build-sea with a custom argv0 value.

require('../common');

const { skipIfBuildSEAIsNotSupported } = require('../common/sea');

skipIfBuildSEAIsNotSupported();

const tmpdir = require('../common/tmpdir');
const fixtures = require('../common/fixtures');
const { copyFileSync } = require('fs');

const { spawnSyncAndAssert } = require('../common/child_process');
tmpdir.refresh();

copyFileSync(
fixtures.path('sea', 'basic', 'sea-config.json'),
tmpdir.resolve('sea-config.json'),
);

copyFileSync(
fixtures.path('sea', 'basic', 'sea.js'),
tmpdir.resolve('sea.js'),
);

spawnSyncAndAssert(
process.execPath,
['--build-sea', tmpdir.resolve('sea-config.json')], {
cwd: tmpdir.path,
argv0: 'argv0',
}, {
stdout: /Generated single executable/,
});