Index: parted-1.8.7/parted/ui.c =================================================================== --- parted-1.8.7.orig/parted/ui.c +++ parted-1.8.7/parted/ui.c @@ -1374,9 +1374,13 @@ init_ui () ped_exception_set_handler (exception_handler); #ifdef HAVE_LIBREADLINE - rl_initialize (); - rl_attempted_completion_function = (CPPFunction*) complete_function; - readline_state.in_readline = 0; + /* check for tty is favorable here because readline might try to set some + * terminal stuff that messes up parsing in non-interactive mode */ + if( isatty(fileno(stdout)) ) { + rl_initialize (); + rl_attempted_completion_function = (CPPFunction*) complete_function; + readline_state.in_readline = 0; + } #endif #ifdef SA_SIGINFO