This likely has nothing to do with Node, but my guess is that whatever program "xtermPath" points to is executing the string passed to -e by passing it to bash, which, as a non-interactive invocation probably isn't loading .bashrc in the same way (I see you have -i to your own invocation...), and it is evaluating $PATH there, and then it is passing the already evaluated string to "/bin/bash -x -c -i", which is the one you're seeing exporting the path, but it has already been evaluated at that point. Try, instead of "echo $PATH", executing a one-line shell script that does the same, and see if the behavior changes. Alternatively, if you expect your path modification to work generally instead of just in an interactive shell, put it in a more appropriate place (although I did think that .bashrc was the right place for this, but it depends on OS and various other configuration options...).
Hope this helps! Jimb Esser On Saturday, August 29, 2015 at 9:59:25 PM UTC-7, Peter Cheung wrote: > > Hi All > > var commandStart='echo $0;cd '+self.item.dir; > var command=';make '+self.item.name; > var commandEnd=''; > var child = spawn(xtermPath, ['-geo', '160x60-10-500', '-hold', '-e', > '/bin/bash -x -c -i "echo $PATH"']); > > It prints the wrong $PATH variable that i have set in .bashrc, why? > > I saw bash has read my .bashrc by using verbose mode, take a look the > image, but the .bashrc just can't take any effect. > > > thanks > from Peter > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/9a90ec06-d0e7-49be-8a20-ecf953f33b94%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
