change terminal handling,add custom command option