Posted 05 February 2013 - 03:06 AM
You say you want to run it in the background, I'm guessing that means as a coroutine, with another shell running on the computer terminal? If so, this would not work as you expect anyway, as monitor simply redirects once before running the program, so any other coroutines running would also be redirected. My own coroutine API, goroutines, could do this, though; with the API loaded you could simply call goroutine.spawnWithRedirect, passing the wrapped monitor as the redirect and shell.run as the function, with your program and any arguments. Goroutines will handle switching redirect targets automatically, so you could run any number of programs on different monitors. I'm on my phone right now, so can't give proper sample code, but there is detailed documentation in my APIs thread and I'll be glad to help more later when I'm back at a computer.
</shamelessselfpromotion>