How to store the result of a stdout? [duplicate]
问题 This question already has answers here : How to return a sdtout from a server to a client inside a string? (2 answers) Closed 2 years ago . I do a UNIX command to list all my files that ends with .svg like this 'getExistingFiles': function () { var list =""; child = exec_tool('cd /home/me/files/; ls *.svg', function (error, stdout, stderr) { list = stdout; console.log(typeof list); console.log("LIST:------------"); console.log(list); return list; if (error !== null) { console.log('exec error: