Created
          March 13, 2017 22:06 
        
      - 
      
- 
        Save g-k/233f531fcbdee50887d55a8a750584af to your computer and use it in GitHub Desktop. 
    nested node exec call debugging
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | » node test.js | |
| outer call $PATH: | |
| /Users/gguthe/.cargo/bin:/Developer/NVIDIA/CUDA-5.0/bin:/usr/local/share/npm/bin:/usr/local/bin:/usr/local/sbin:/usr/local/lib:/usr/local/lib/python2.7/site-packages:/Users/gguthe/bin:/Users/gguthe/.cabal/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/gguthe/.cargo/bin:/Developer/NVIDIA/CUDA-5.0/bin:/usr/local/share/npm/bin:/usr/local/lib:/usr/local/lib/python2.7/site-packages:/Users/gguthe/bin:/Users/gguthe/.cabal/bin:/usr/local/opt/go/libexec/bin:/Users/gguthe/bin/bin:/usr/local/opt/go/libexec/bin:/Users/gguthe/bin/bin | |
| inner call $PATH: | |
| /usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:. | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /* This Source Code Form is subject to the terms of the Mozilla Public | |
| * License, v. 2.0. If a copy of the MPL was not distributed with this | |
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
| var cp = require('child_process') | |
| var cmd = 'echo $PATH' | |
| cp.exec(cmd, function(err, stdout) { | |
| var cmd = 'echo $PATH' | |
| console.log('outer call $PATH:\n', stdout) | |
| cp.exec(cmd, { env: { GIT_CONFIG: 'BLAH' } }, function(err, stdout) { | |
| console.log('inner call $PATH:\n', stdout) | |
| }) | |
| }) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment