mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-27191 MariaDB client - "system" command does not work on Windows
- define USE_POPEN, like it is done elsewhere. - use Notepad as default editor on Windows for the "edit" command.
This commit is contained in:
@@ -96,8 +96,8 @@ extern "C" {
|
|||||||
# include <readline.h>
|
# include <readline.h>
|
||||||
# endif
|
# endif
|
||||||
#define HAVE_READLINE
|
#define HAVE_READLINE
|
||||||
#define USE_POPEN
|
|
||||||
#endif
|
#endif
|
||||||
|
#define USE_POPEN
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_VIDATTR
|
#ifdef HAVE_VIDATTR
|
||||||
@@ -4210,11 +4210,6 @@ com_nopager(String *buffer __attribute__((unused)),
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Sorry, you can't send the result to an editor in Win32
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef USE_POPEN
|
#ifdef USE_POPEN
|
||||||
static int
|
static int
|
||||||
com_edit(String *buffer,char *line __attribute__((unused)))
|
com_edit(String *buffer,char *line __attribute__((unused)))
|
||||||
@@ -4236,7 +4231,7 @@ com_edit(String *buffer,char *line __attribute__((unused)))
|
|||||||
|
|
||||||
if (!(editor = (char *)getenv("EDITOR")) &&
|
if (!(editor = (char *)getenv("EDITOR")) &&
|
||||||
!(editor = (char *)getenv("VISUAL")))
|
!(editor = (char *)getenv("VISUAL")))
|
||||||
editor = "vi";
|
editor = IF_WIN("notepad","vi");
|
||||||
strxmov(buff,editor," ",filename,NullS);
|
strxmov(buff,editor," ",filename,NullS);
|
||||||
if ((error= system(buff)))
|
if ((error= system(buff)))
|
||||||
{
|
{
|
||||||
@@ -4251,7 +4246,7 @@ com_edit(String *buffer,char *line __attribute__((unused)))
|
|||||||
if ((fd = my_open(filename,O_RDONLY, MYF(MY_WME))) < 0)
|
if ((fd = my_open(filename,O_RDONLY, MYF(MY_WME))) < 0)
|
||||||
goto err;
|
goto err;
|
||||||
(void) buffer->alloc((uint) stat_arg.st_size);
|
(void) buffer->alloc((uint) stat_arg.st_size);
|
||||||
if ((tmp=read(fd,(char*) buffer->ptr(),buffer->alloced_length())) >= 0L)
|
if ((tmp=(int)my_read(fd,(uchar*) buffer->ptr(),buffer->alloced_length(),MYF(0))) >= 0)
|
||||||
buffer->length((uint) tmp);
|
buffer->length((uint) tmp);
|
||||||
else
|
else
|
||||||
buffer->length(0);
|
buffer->length(0);
|
||||||
|
Reference in New Issue
Block a user