whenever run co generator loop, nothing happens after execution process hangs. how terminate after completion?
co(function *() { // code; })
co()
returns promise. return loop , handle .then()
. here return string "done"
, send console.log
, , terminate process. errors printed console.
co(function *() { return "done"; }).then( res => { console.log(res); process.exit() } ).catch(err => console.error(err) );