Claude and claude[bot]
40607aa37f
fix(scripts): isMainModule compares real paths of argv and module ( #733 )
...
process.argv[1] keeps the path as typed, so a script started through a
symlink (or from a symlinked directory) still carries the link path there,
while Node builds import.meta.url of the main module from the real path.
The two never matched, and every CLI guarded by isMainModule silently did
nothing and exited 0. Both sides are now resolved with realpathSync before
the pathToFileURL comparison; a path that does not exist is compared as is,
without throwing, exactly as before.
The unit test writes a CLI and a module it imports into a temporary
directory, launches the CLI directly, through a directory link (a junction
on Windows, no admin rights needed) and through a file symlink (skipped on
EPERM), and checks that only the launched script runs its main. It is red
on the previous implementation.
Issue: #733
User-Visible: no
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_018qZfe7YS4rqEMKoVeS3GKd
2026-09-30 23:19:47 +00:00
..
2026-09-27 16:23:39 +00:00
2026-09-04 00:41:40 +03:00
2026-09-02 00:05:36 +00:00
2026-09-24 10:23:28 +03:00
2026-09-04 19:26:35 +03:00
2026-08-30 21:34:32 +03:00
2026-09-08 21:55:07 +00:00
2026-08-26 02:20:57 +03:00
2026-09-27 22:33:03 +03:00
2026-09-30 18:38:57 +03:00
2026-09-30 12:25:46 +03:00
2026-09-26 07:28:23 +00:00
2026-09-26 07:28:23 +00:00
2026-09-12 09:39:05 +03:00
2026-09-02 22:10:16 +03:00
2026-09-17 23:19:56 +03:00
2026-09-29 00:30:04 +03:00
2026-09-29 01:22:14 +03:00
2026-09-30 12:25:46 +03:00
2026-09-29 23:04:41 +03:00
2026-09-30 18:27:54 +00:00
2026-09-29 23:04:41 +03:00
2026-08-30 13:04:04 +03:00
2026-09-15 00:16:35 +03:00
2026-09-30 12:25:46 +03:00
2026-09-05 09:25:08 +03:00
2026-09-11 10:12:13 +03:00
2026-09-26 07:28:23 +00:00
2026-09-09 18:53:38 +03:00
2026-09-01 17:54:48 +03:00
2026-09-06 15:39:34 +03:00
2026-08-30 18:31:42 +03:00
2026-09-24 01:35:25 +00:00
2026-09-29 00:30:04 +03:00
2026-08-26 01:34:20 +03:00
2026-09-16 23:02:11 +03:00
2026-09-13 10:49:07 +03:00
2026-09-29 08:45:44 +03:00
2026-09-21 15:01:18 +03:00
2026-09-30 12:25:46 +03:00
2026-09-07 03:47:57 +03:00
2026-08-28 18:18:24 +03:00
2026-09-01 17:25:54 +03:00
2026-09-26 07:28:23 +00:00
2026-09-26 07:28:23 +00:00
2026-08-13 14:58:57 +03:00
2026-09-27 17:08:06 +03:00
2026-09-24 02:33:08 +00:00
2026-09-30 22:26:44 +00:00
2026-09-14 02:28:50 +03:00
2026-09-30 18:38:57 +03:00
2026-09-28 22:39:36 +00:00
2026-09-14 08:55:17 +03:00
2026-09-28 22:39:36 +00:00
2026-09-27 17:08:06 +03:00
2026-09-24 05:48:42 +00:00
2026-09-13 20:29:35 +03:00
2026-09-27 17:08:06 +03:00
2026-09-21 14:12:17 +03:00
2026-09-27 17:08:06 +03:00
2026-09-25 18:31:17 +03:00
2026-09-24 05:48:42 +00:00
2026-09-28 22:39:36 +00:00
2026-09-30 22:39:24 +00:00
2026-09-13 20:29:35 +03:00
2026-09-27 22:33:03 +03:00
2026-09-25 08:58:05 +03:00
2026-09-16 21:34:39 +03:00
2026-09-09 18:53:38 +03:00
2026-09-29 23:04:41 +03:00
2026-09-29 00:30:04 +03:00
2026-09-27 22:10:46 +00:00
2026-09-23 08:51:17 +03:00
2026-09-23 08:51:17 +03:00
2026-09-29 23:04:41 +03:00
2026-09-28 22:39:36 +00:00
2026-09-28 21:01:38 +00:00
2026-09-26 07:28:23 +00:00
2026-09-13 10:35:43 +03:00
2026-09-13 10:35:43 +03:00
2026-09-13 07:42:23 +03:00
2026-09-26 10:02:40 +03:00
2026-09-13 10:35:43 +03:00
2026-08-27 18:55:41 +03:00
2026-09-28 22:39:36 +00:00
2026-09-25 12:53:14 +03:00
2026-09-26 09:05:20 +03:00
2026-09-27 22:10:46 +00:00
2026-09-13 16:24:10 +00:00
2026-09-28 23:09:46 +03:00
2026-09-28 23:09:46 +03:00
2026-09-26 07:28:23 +00:00
2026-08-30 12:45:17 +03:00
2026-09-28 23:09:46 +03:00
2026-09-30 15:18:00 +03:00
2026-09-29 08:45:44 +03:00
2026-09-06 21:00:39 +00:00
2026-09-30 23:19:47 +00:00
2026-09-29 07:19:05 +03:00
2026-09-24 02:33:08 +00:00
2026-09-16 23:02:11 +03:00
2026-09-29 08:45:44 +03:00
2026-09-24 05:00:45 +03:00
2026-09-13 06:05:45 +00:00
2026-09-08 21:55:07 +00:00
2026-09-28 22:39:36 +00:00
2026-09-27 09:18:50 +00:00
2026-09-29 00:30:04 +03:00
2026-09-28 23:38:50 +03:00
2026-09-08 00:31:25 +03:00
2026-09-13 13:05:25 +03:00
2026-08-24 01:47:22 +03:00
2026-09-13 06:05:45 +00:00
2026-09-27 13:57:21 +03:00
2026-09-13 06:05:45 +00:00