Added two ways to wait for stdout to flush.  Also changed spawn_console.js so that the console app can be specified via command line argument