Created
July 13, 2010 12:25
-
-
Save jklaiho/473786 to your computer and use it in GitHub Desktop.
This file contains 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
// in REPL | |
var exec = require('child_process').exec; | |
var child; | |
var uid = 123; | |
child = exec('id -u root', function(error, stdout, stderr) { | |
// trying to update the uid variable outside this function | |
uid = parseInt(stdout, 10); | |
console.log(uid) // prints 0 | |
}); | |
// ... | |
// afterwards, when the child process is good and done: | |
console.log(uid) // still prints 123 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment