Commit af32d43
lib: account for cwd access from snapshot serialization cb
Functions registered with `addSerializeCallback()` can access and call
`process.cwd()`. b7d836e accounted for the fact that it is
necessary to reset the cwd cache after the snapshot builder script has
run, but did not account for possible accesses from serialization
callbacks. To properly account for these, add a deserialization
callback as well.
As a related drive-by fix, also mention the execution order of
callbacks in the documentation.
Refs: #49684
PR-URL: #51901
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>1 parent 1edbc7d commit af32d43Copy full SHA for af32d43
File tree
Expand file treeCollapse file tree
3 files changed
+16
-0
lines changedOpen diff view settings
Filter options
- doc/api
- lib/internal/bootstrap/switches
- test/fixtures/snapshot
Expand file treeCollapse file tree
3 files changed
+16
-0
lines changedOpen diff view settings
Collapse file
+4Lines changed: 4 additions & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1021 | 1021 | |
1022 | 1022 | |
1023 | 1023 | |
| 1024 | + |
| 1025 | + |
1024 | 1026 | |
1025 | 1027 | |
1026 | 1028 | |
| ||
1040 | 1042 | |
1041 | 1043 | |
1042 | 1044 | |
| 1045 | + |
| 1046 | + |
1043 | 1047 | |
1044 | 1048 | |
1045 | 1049 | |
|
Collapse file
lib/internal/bootstrap/switches/does_own_process_state.js
Copy file name to clipboardExpand all lines: lib/internal/bootstrap/switches/does_own_process_state.js+6Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
4 | 4 | |
5 | 5 | |
6 | 6 | |
| 7 | + |
7 | 8 | |
8 | 9 | |
9 | 10 | |
| ||
114 | 115 | |
115 | 116 | |
116 | 117 | |
| 118 | + |
| 119 | + |
117 | 120 | |
118 | 121 | |
| 122 | + |
| 123 | + |
| 124 | + |
119 | 125 | |
120 | 126 | |
121 | 127 | |
|
Collapse file
test/fixtures/snapshot/cwd.js
Copy file name to clipboard+6Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1 | 1 | |
| 2 | + |
2 | 3 | |
3 | 4 | |
4 | 5 | |
5 | 6 | |
6 | 7 | |
7 | 8 | |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
8 | 14 | |
9 | 15 | |
10 | 16 | |
0 commit comments