Re: [RFC] Indicate that Git waits for user input via editor
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 16, 2017, 05:37 UTC
- Message-ID
- <xmqq375ewzqk.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <xmqq8tf7yxzn.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
> I wonder if we can do something like > ... > to tentatively give a message without permanently wasting the > vertical space.
Learning from 13e4760a ("recv_sideband: Do not use ANSI escape sequence on dumb terminals.", 2008-01-08), I think the above should be more like this:
git_spawn_editor()
{
static const char *finish; if (!finish) {
const char ANSI_FINISH[] = "\r\033[K";
const char DUMB_FINISH[] = "done.\n";
char *term = getenv("TERM");if (term && strcmp(term, "dumb")) finish = ANSI_FINISH; else finish = DUMB_FINISH; }
/* notice the lack of terminating LF */ fprintf(stderr, "Launched your editor, waiting..."); fflush(stderr);
if (!run_command(... spawn the editor ...)) fputs(finish, stderr); else fprintf(stderr, "failed (%s)\n", strerror(errno)); fflush(stderr); }