psql's EDITOR behavior on Windows

Поиск
Список
Период
Сортировка
От Pavlo Golub
Тема psql's EDITOR behavior on Windows
Дата
Msg-id CAK7ymcLwDia8deBCX+oLjSbHrJM32LuvomXq7i6uJ3g7z-MhAw@mail.gmail.com
обсуждение исходный текст
Ответы Re: psql's EDITOR behavior on Windows  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hello.

I cannot find the reason why EDITOR value on Windows is quoted. It
should not be. One may force quote env var if he wants to.

Right now, for example, one cannot use sublime, since to use it in a
proper way you should
SET EDITOR="C:\Program Files\Sublime\subl.exe" --wait

The problem can be solved by introducing PSQL_EDITOR_ARGS env var, but
just not quoting EDITOR command on Windows will work too.

psql\command.c:

static bool
editFile(const char *fname, int lineno)
{
    ...

        /*
     * On Unix the EDITOR value should *not* be quoted, since it might include
     * switches, eg, EDITOR="pico -t"; it's up to the user to put quotes in it
     * if necessary.  But this policy is not very workable on Windows, due to
     * severe brain damage in their command shell plus the fact that standard
     * program paths include spaces.
     */
    ...
    if (lineno > 0)
        sys = psprintf("\"%s\" %s%d \"%s\"",
                       editorName, editor_lineno_arg, lineno, fname);
    else
        sys = psprintf("\"%s\" \"%s\"",
                       editorName, fname);
    ...
}



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Unix-domain socket support on Windows
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Read Uncommitted