Do not use readline for non-interactive sessions (e.g. those taking
input from a pipe or file). This way stray prompts are not shown.
Explicit prompts are retained, in case some script expects them.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
char *hosturl;
char *hostname;
int bash;
+ int interactive;
int shrink_urls;
int dry_run;
int page;
int (*bind_key)(int, void *);
void (*insert)(void);
- /* default to internal function if we can't find anything */
+ /* default to internal function if we can't or won't find anything */
session->readline = get_string;
+ if (!isatty(0))
+ return;
+ session->interactive = 1;
tmp = malloc(strlen(libpath)+1);
if (!tmp)
}
if (session->action == ACTION_UPDATE) {
- if (session->bash)
+ if (session->bash || !session->interactive)
tweet = get_string_from_stdin();
else
tweet = session->readline("tweet: ");