title: Why NODE_DEBUG=fs environment variable is set but not working?
body: <p>Node.js docs about a <code>fs</code> module says (<a href="https://nodejs.org/api/fs.html#fs_file_system" rel="nofollow">https://nodejs.org/api/fs.html#fs_file_system</a>):</p>
  
  <blockquote>
    <p>To get a trace to the original call site, set the NODE_DEBUG environment variable:</p>
  </blockquote>
  
  <p>And an example of setting an <code>fs</code> env variable:</p>
  
  <pre><code>$ env NODE_DEBUG=fs node script.js
  fs.js:66
      throw err;
            ^
  Error: EISDIR, read
  at rethrow (fs.js:61:21)
  at maybeCallback (fs.js:79:42)
  at Object.fs.readFile (fs.js:153:18)
  at bad (/path/to/script.js:2:17)
  at Object.&lt;anonymous&gt; (/path/to/script.js:5:1)
  &lt;etc.&gt;
  </code></pre>
  
  <p>However, if I set <code>fs</code> env variable upfront in command line or using <code>process.env</code> in the script, the variable is set but doesn't work, no trace is shown:</p>
  
  <p>Upfront in command line:</p>
  
  <pre><code>$ env NODE_DEBUG=fs // set before running a script
  $ node script.js // doesn't bring the trace
  </code></pre>
  
  <p>In the script:</p>
  
  <pre><code>'use strict';
  process.env.NODE_DEBUG = 'fs'; // set it on the second line of a script
  
  &lt;...&gt; // script goes here
  </code></pre>
  
  <p>I both cases the result is as follows, no trace, though NODE_DEBUG=fs is set:</p>
  
  <pre><code>fs.js:81
        throw err;  // Forgot a callback but don't know where? Use NODE_DEBUG=fs
          ^
  Error: EISDIR, read
      at Error (native)
  </code></pre>
  
  <p>The question is. 
  Why command line inline variable setting works:</p>
  
  <p><code>$ env NODE_DEBUG=fs node script.js</code>, </p>
  
  <p>but other ways of setting it do not work? </p>