From bff93cead86605f2261a96555797e861d166bae3 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Fri, 6 Feb 2026 09:19:05 -0500 Subject: [PATCH 01/10] src: fix `--build-sea` default executable path --- src/node_sea_bin.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_sea_bin.cc b/src/node_sea_bin.cc index dc9c9e614f8fca..e0993607cb7ba0 100644 --- a/src/node_sea_bin.cc +++ b/src/node_sea_bin.cc @@ -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. From 8b62eac43cda3686a1caea316717176bf2e63c66 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Fri, 6 Feb 2026 11:49:31 -0500 Subject: [PATCH 02/10] Add test --- test/sea/test-build-sea-custom-argv0.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/sea/test-build-sea-custom-argv0.js diff --git a/test/sea/test-build-sea-custom-argv0.js b/test/sea/test-build-sea-custom-argv0.js new file mode 100644 index 00000000000000..e39991080d147a --- /dev/null +++ b/test/sea/test-build-sea-custom-argv0.js @@ -0,0 +1,23 @@ +'use strict'; +// This tests --build-sea with a custom argv0 value. + +require('../common'); + +const { skipIfBuildSEAIsNotSupported } = require('../common/sea'); + +skipIfBuildSEAIsNotSupported(); + +const { resolve } = require('path'); +const fixtures = require('../common/fixtures'); + +const { spawnSyncAndAssert } = require('../common/child_process'); +const fixturesDir = fixtures.path('sea', 'basic'); + +spawnSyncAndAssert( + process.execPath, + ['--build-sea', resolve(fixturesDir, 'sea-config.json')], { + cwd: fixturesDir, + argv0: 'argv0', + }, { + stdout: /Generated single executable/, + }); From ebb070f563b0180baac6122588678bb789cda5ce Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Fri, 6 Feb 2026 11:58:10 -0500 Subject: [PATCH 03/10] Cleanup after test --- test/sea/test-build-sea-custom-argv0.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/sea/test-build-sea-custom-argv0.js b/test/sea/test-build-sea-custom-argv0.js index e39991080d147a..a46ba702cd8450 100644 --- a/test/sea/test-build-sea-custom-argv0.js +++ b/test/sea/test-build-sea-custom-argv0.js @@ -9,6 +9,7 @@ skipIfBuildSEAIsNotSupported(); const { resolve } = require('path'); const fixtures = require('../common/fixtures'); +const { rmSync } = require('fs'); const { spawnSyncAndAssert } = require('../common/child_process'); const fixturesDir = fixtures.path('sea', 'basic'); @@ -21,3 +22,5 @@ spawnSyncAndAssert( }, { stdout: /Generated single executable/, }); + +rmSync(resolve(fixturesDir, 'sea')); From a756a12cbf4768568a457dccce984b4f661693bd Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Fri, 6 Feb 2026 13:36:33 -0500 Subject: [PATCH 04/10] use temp dir --- test/sea/test-build-sea-custom-argv0.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/test/sea/test-build-sea-custom-argv0.js b/test/sea/test-build-sea-custom-argv0.js index a46ba702cd8450..e17ad653aaddd5 100644 --- a/test/sea/test-build-sea-custom-argv0.js +++ b/test/sea/test-build-sea-custom-argv0.js @@ -7,20 +7,31 @@ const { skipIfBuildSEAIsNotSupported } = require('../common/sea'); skipIfBuildSEAIsNotSupported(); +const tmpdir = require('../common/tmpdir'); const { resolve } = require('path'); const fixtures = require('../common/fixtures'); -const { rmSync } = require('fs'); +const { copyFileSync } = require('fs'); const { spawnSyncAndAssert } = require('../common/child_process'); + const fixturesDir = fixtures.path('sea', 'basic'); +const tempDir = tmpdir.path; + +copyFileSync( + resolve(fixturesDir, 'sea-config.json'), + resolve(tempDir, 'sea-config.json') +); + +copyFileSync( + resolve(fixturesDir, 'sea.js'), + resolve(tempDir, 'sea.js') +); spawnSyncAndAssert( process.execPath, - ['--build-sea', resolve(fixturesDir, 'sea-config.json')], { - cwd: fixturesDir, + ['--build-sea', resolve(tempDir, 'sea-config.json')], { + cwd: tempDir, argv0: 'argv0', }, { stdout: /Generated single executable/, }); - -rmSync(resolve(fixturesDir, 'sea')); From d2f53771537d39af2c9a15ca2832f56c6eaf503d Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Fri, 6 Feb 2026 13:48:30 -0500 Subject: [PATCH 05/10] fix lint --- test/sea/test-build-sea-custom-argv0.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/sea/test-build-sea-custom-argv0.js b/test/sea/test-build-sea-custom-argv0.js index e17ad653aaddd5..c6f8ba066cf754 100644 --- a/test/sea/test-build-sea-custom-argv0.js +++ b/test/sea/test-build-sea-custom-argv0.js @@ -19,12 +19,12 @@ const tempDir = tmpdir.path; copyFileSync( resolve(fixturesDir, 'sea-config.json'), - resolve(tempDir, 'sea-config.json') + resolve(tempDir, 'sea-config.json'), ); copyFileSync( resolve(fixturesDir, 'sea.js'), - resolve(tempDir, 'sea.js') + resolve(tempDir, 'sea.js'), ); spawnSyncAndAssert( From 3e0ab1d8d8d845622b2bc7a448efc3b15d510aea Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Fri, 6 Feb 2026 21:11:34 -0500 Subject: [PATCH 06/10] Apply suggestions from code review Co-authored-by: Joyee Cheung --- test/sea/test-build-sea-custom-argv0.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/sea/test-build-sea-custom-argv0.js b/test/sea/test-build-sea-custom-argv0.js index c6f8ba066cf754..43b1fd124bea6c 100644 --- a/test/sea/test-build-sea-custom-argv0.js +++ b/test/sea/test-build-sea-custom-argv0.js @@ -16,20 +16,20 @@ const { spawnSyncAndAssert } = require('../common/child_process'); const fixturesDir = fixtures.path('sea', 'basic'); const tempDir = tmpdir.path; - +tmpdir.refresh(); copyFileSync( - resolve(fixturesDir, 'sea-config.json'), - resolve(tempDir, 'sea-config.json'), + fixtures.path('sea-config.json'), + tmpdir.resolve('sea-config.json'), ); copyFileSync( - resolve(fixturesDir, 'sea.js'), - resolve(tempDir, 'sea.js'), + fixtures.path('sea.js'), + tmpdir.resolve('sea.js'), ); spawnSyncAndAssert( process.execPath, - ['--build-sea', resolve(tempDir, 'sea-config.json')], { + ['--build-sea', tmpdir.resolve('sea-config.json')], { cwd: tempDir, argv0: 'argv0', }, { From 94a3be076e31bbcf869949b071a53ed6497bb786 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Fri, 6 Feb 2026 21:15:04 -0500 Subject: [PATCH 07/10] Update test-build-sea-custom-argv0.js --- test/sea/test-build-sea-custom-argv0.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/sea/test-build-sea-custom-argv0.js b/test/sea/test-build-sea-custom-argv0.js index 43b1fd124bea6c..caffb6b12d41c7 100644 --- a/test/sea/test-build-sea-custom-argv0.js +++ b/test/sea/test-build-sea-custom-argv0.js @@ -13,10 +13,8 @@ const fixtures = require('../common/fixtures'); const { copyFileSync } = require('fs'); const { spawnSyncAndAssert } = require('../common/child_process'); - -const fixturesDir = fixtures.path('sea', 'basic'); -const tempDir = tmpdir.path; tmpdir.refresh(); + copyFileSync( fixtures.path('sea-config.json'), tmpdir.resolve('sea-config.json'), @@ -30,7 +28,7 @@ copyFileSync( spawnSyncAndAssert( process.execPath, ['--build-sea', tmpdir.resolve('sea-config.json')], { - cwd: tempDir, + cwd: tmpdir.path, argv0: 'argv0', }, { stdout: /Generated single executable/, From bf058ae5d5f46160ac5a7e52a846bd2d060f6361 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Fri, 6 Feb 2026 21:21:54 -0500 Subject: [PATCH 08/10] Update test-build-sea-custom-argv0.js --- test/sea/test-build-sea-custom-argv0.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/sea/test-build-sea-custom-argv0.js b/test/sea/test-build-sea-custom-argv0.js index caffb6b12d41c7..aa9aaa490eb221 100644 --- a/test/sea/test-build-sea-custom-argv0.js +++ b/test/sea/test-build-sea-custom-argv0.js @@ -8,7 +8,6 @@ const { skipIfBuildSEAIsNotSupported } = require('../common/sea'); skipIfBuildSEAIsNotSupported(); const tmpdir = require('../common/tmpdir'); -const { resolve } = require('path'); const fixtures = require('../common/fixtures'); const { copyFileSync } = require('fs'); From 6b6a27c6b1a68eed2ce096a150d2e98ec06f5e79 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Sat, 7 Feb 2026 07:02:58 -0500 Subject: [PATCH 09/10] Apply suggestions from code review Co-authored-by: Joyee Cheung --- test/sea/test-build-sea-custom-argv0.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/sea/test-build-sea-custom-argv0.js b/test/sea/test-build-sea-custom-argv0.js index aa9aaa490eb221..a2c124cc618304 100644 --- a/test/sea/test-build-sea-custom-argv0.js +++ b/test/sea/test-build-sea-custom-argv0.js @@ -15,12 +15,12 @@ const { spawnSyncAndAssert } = require('../common/child_process'); tmpdir.refresh(); copyFileSync( - fixtures.path('sea-config.json'), + fixtures.path('sea', 'basic', sea-config.json'), tmpdir.resolve('sea-config.json'), ); copyFileSync( - fixtures.path('sea.js'), + fixtures.path('sea', 'basic', sea.js'), tmpdir.resolve('sea.js'), ); From 643a70eb4824a2d7fb4e18251238637989ae7f3b Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Sat, 7 Feb 2026 07:04:07 -0500 Subject: [PATCH 10/10] Update test-build-sea-custom-argv0.js --- test/sea/test-build-sea-custom-argv0.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/sea/test-build-sea-custom-argv0.js b/test/sea/test-build-sea-custom-argv0.js index a2c124cc618304..2c8b6b83e02cdb 100644 --- a/test/sea/test-build-sea-custom-argv0.js +++ b/test/sea/test-build-sea-custom-argv0.js @@ -15,12 +15,12 @@ const { spawnSyncAndAssert } = require('../common/child_process'); tmpdir.refresh(); copyFileSync( - fixtures.path('sea', 'basic', sea-config.json'), + fixtures.path('sea', 'basic', 'sea-config.json'), tmpdir.resolve('sea-config.json'), ); copyFileSync( - fixtures.path('sea', 'basic', sea.js'), + fixtures.path('sea', 'basic', 'sea.js'), tmpdir.resolve('sea.js'), );