process.exec() in node.js

Here is the code i wrote,when i execute the code,the terminal didn't output anything and the program is blocked

var util=require('util')
var exec=require('child_process').exec;
exec('iostat 5',function(err,stdout,stderr){
    util.puts("hello")
    util.puts(stdout)
})

If i change the exec command like this: it works and outputs the file list

var util=require('util')
var exec=require('child_process').exec;
exec('ls -al',function(err,stdout,stderr){
    util.puts("hello")
    util.puts(stdout)
})

is there any diffent between a block command(iostat) and nonbolck command(ls)?

iostat 5 loops forever every 5 seconds and never terminates, so your exec callback will never be called. Instead you could call iostat from a setInterval call, or just remove the 5 if you only need it once.