mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
win32.c: UTF-8 spawn
* win32/win32.c (w32_spawn): extract codepage aware code from rb_w32_spawn(). * win32/win32.c (rb_w32_uspawn): add UTF-8 version function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
64d39448d3
commit
dc0b06aa38
3 changed files with 25 additions and 5 deletions
|
@ -1,4 +1,9 @@
|
|||
Sun Jun 30 10:59:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
Sun Jun 30 10:59:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* win32/win32.c (w32_spawn): extract codepage aware code from
|
||||
rb_w32_spawn().
|
||||
|
||||
* win32/win32.c (rb_w32_uspawn): add UTF-8 version function.
|
||||
|
||||
* win32/win32.c (w32_aspawn_flags): extract codepage aware code from
|
||||
rb_w32_aspawn_flags().
|
||||
|
|
|
@ -316,6 +316,7 @@ extern rb_pid_t waitpid (rb_pid_t, int *, int);
|
|||
extern rb_pid_t rb_w32_spawn(int, const char *, const char*);
|
||||
extern rb_pid_t rb_w32_aspawn(int, const char *, char *const *);
|
||||
extern rb_pid_t rb_w32_aspawn_flags(int, const char *, char *const *, DWORD);
|
||||
extern rb_pid_t rb_w32_uspawn(int, const char *, const char*);
|
||||
extern rb_pid_t rb_w32_uaspawn(int, const char *, char *const *);
|
||||
extern rb_pid_t rb_w32_uaspawn_flags(int, const char *, char *const *, DWORD);
|
||||
extern int kill(int, int);
|
||||
|
|
|
@ -1180,7 +1180,7 @@ static char *wstr_to_mbstr(UINT, const WCHAR *, int, long *);
|
|||
|
||||
/* License: Artistic or GPL */
|
||||
rb_pid_t
|
||||
rb_w32_spawn(int mode, const char *cmd, const char *prog)
|
||||
w32_spawn(int mode, const char *cmd, const char *prog, UINT cp)
|
||||
{
|
||||
char fbuf[MAXPATHLEN];
|
||||
char *p = NULL;
|
||||
|
@ -1270,10 +1270,9 @@ rb_w32_spawn(int mode, const char *cmd, const char *prog)
|
|||
}
|
||||
}
|
||||
|
||||
/* assume ACP */
|
||||
if (!e && cmd && !(wcmd = acp_to_wstr(cmd, NULL))) e = E2BIG;
|
||||
if (!e && cmd && !(wcmd = mbstr_to_wstr(cp, cmd, -1, NULL))) e = E2BIG;
|
||||
if (v) ALLOCV_END(v);
|
||||
if (!e && shell && !(wshell = acp_to_wstr(shell, NULL))) e = E2BIG;
|
||||
if (!e && shell && !(wshell = mbstr_to_wstr(cp, shell, -1, NULL))) e = E2BIG;
|
||||
if (v2) ALLOCV_END(v2);
|
||||
|
||||
if (!e) {
|
||||
|
@ -1285,6 +1284,21 @@ rb_w32_spawn(int mode, const char *cmd, const char *prog)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* License: Ruby's */
|
||||
rb_pid_t
|
||||
rb_w32_spawn(int mode, const char *cmd, const char *prog)
|
||||
{
|
||||
/* assume ACP */
|
||||
return w32_spawn(mode, cmd, prog, filecp());
|
||||
}
|
||||
|
||||
/* License: Ruby's */
|
||||
rb_pid_t
|
||||
rb_w32_uspawn(int mode, const char *cmd, const char *prog)
|
||||
{
|
||||
return w32_spawn(mode, cmd, prog, CP_UTF8);
|
||||
}
|
||||
|
||||
/* License: Artistic or GPL */
|
||||
rb_pid_t
|
||||
w32_aspawn_flags(int mode, const char *prog, char *const *argv, DWORD flags, UINT cp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue