| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 44427cc commit 60a5b51
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -287,6 +287,13 @@ added: v0.11.15 | |||
| 287 | 287 | Data path for ICU (Intl object) data. Will extend linked-in data when compiled | |
| 288 | 288 | with small-icu support. | |
| 289 | 289 | ||
| 290 | + ### `NODE_PRESERVE_SYMLINKS=1` | ||
| 291 | + <!-- YAML | ||
| 292 | + added: REPLACEME | ||
| 293 | + --> | ||
| 294 | + | ||
| 295 | + When set to `1`, instructs the module loader to preserve symbolic links when | ||
| 296 | + resolving and caching modules. | ||
| 290 | 297 | ||
| 291 | 298 | ### `NODE_REPL_HISTORY=file` | |
| 292 | 299 | <!-- YAML | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4192,6 +4192,11 @@ void Init(int* argc, | |||
| 4192 | 4192 | V8::SetFlagsFromString(NODE_V8_OPTIONS, sizeof(NODE_V8_OPTIONS) - 1); | |
| 4193 | 4193 | #endif | |
| 4194 | 4194 | ||
| 4195 | + // Allow for environment set preserving symlinks. | ||
| 4196 | + if (auto preserve_symlinks = secure_getenv("NODE_PRESERVE_SYMLINKS")) { | ||
| 4197 | + config_preserve_symlinks = (*preserve_symlinks == '1'); | ||
| 4198 | + } | ||
| 4199 | + | ||
| 4195 | 4200 | // Parse a few arguments which are specific to Node. | |
| 4196 | 4201 | int v8_argc; | |
| 4197 | 4202 | const char** v8_argv; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,6 +6,7 @@ const path = require('path'); | |||
| 6 | 6 | const fs = require('fs'); | |
| 7 | 7 | const exec = require('child_process').exec; | |
| 8 | 8 | const spawn = require('child_process').spawn; | |
| 9 | + const util = require('util'); | ||
| 9 | 10 | ||
| 10 | 11 | common.refreshTmpDir(); | |
| 11 | 12 | ||
@@ -53,7 +54,16 @@ function test() { | |||
| 53 | 54 | const node = process.execPath; | |
| 54 | 55 | const child = spawn(node, ['--preserve-symlinks', linkScript]); | |
| 55 | 56 | child.on('close', function(code, signal) { | |
| 56 | - assert(!code); | ||
| 57 | + assert.strictEqual(code, 0); | ||
| 58 | + assert(!signal); | ||
| 59 | + }); | ||
| 60 | + | ||
| 61 | + // Also verify that symlinks works for setting preserve via env variables | ||
| 62 | + const childEnv = spawn(node, [linkScript], { | ||
| 63 | + env: util._extend(process.env, {NODE_PRESERVE_SYMLINKS: '1'}) | ||
| 64 | + }); | ||
| 65 | + childEnv.on('close', function(code, signal) { | ||
| 66 | + assert.strictEqual(code, 0); | ||
| 57 | 67 | assert(!signal); | |
| 58 | 68 | }); | |
| 59 | 69 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments