Full function idascript with stdin/stdout handled