close devnull and use p.wait() return val