aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/pty_process_win.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-08-13 05:47:58 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-08-15 00:28:41 +0200
commit8727f7a6a4ef10ce7536fbc003ef13b768f1aa91 (patch)
tree8b577b3e7b8e997341bbad3747dd19f7015da216 /src/nvim/os/pty_process_win.c
parentfc60d92795d20f3f3c498b97aae5e46a71cafa8d (diff)
downloadrneovim-8727f7a6a4ef10ce7536fbc003ef13b768f1aa91.tar.gz
rneovim-8727f7a6a4ef10ce7536fbc003ef13b768f1aa91.tar.bz2
rneovim-8727f7a6a4ef10ce7536fbc003ef13b768f1aa91.zip
utf8_to_utf16: align with libuv
- take a size parameter - always NUL-terminate the result - return libuv error code - handle error in caller only (avoid redundant messages) https://github.com/libuv/libuv/commit/53995a3825d23eacd01e2bcfa35642c4a188d32b https://github.com/libuv/libuv/commit/4c945f49365ab4d6e1b07bf0ef2893455dc04622
Diffstat (limited to 'src/nvim/os/pty_process_win.c')
-rw-r--r--src/nvim/os/pty_process_win.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/nvim/os/pty_process_win.c b/src/nvim/os/pty_process_win.c
index 290668bca3..ef48da953a 100644
--- a/src/nvim/os/pty_process_win.c
+++ b/src/nvim/os/pty_process_win.c
@@ -93,9 +93,9 @@ int pty_process_spawn(PtyProcess *ptyproc)
}
if (proc->cwd != NULL) {
- status = utf8_to_utf16(proc->cwd, &cwd);
+ status = utf8_to_utf16(proc->cwd, -1, &cwd);
if (status != 0) {
- emsg = "Failed to convert pwd form utf8 to utf16.";
+ emsg = "utf8_to_utf16 failed";
goto cleanup;
}
}
@@ -103,7 +103,7 @@ int pty_process_spawn(PtyProcess *ptyproc)
status = build_cmd_line(proc->argv, &cmd_line,
os_shell_is_cmdexe(proc->argv[0]));
if (status != 0) {
- emsg = "Failed to convert cmd line form utf8 to utf16.";
+ emsg = "build_cmd_line failed";
goto cleanup;
}
@@ -115,7 +115,7 @@ int pty_process_spawn(PtyProcess *ptyproc)
NULL, // Optional environment variables
&err);
if (spawncfg == NULL) {
- emsg = "Failed winpty_spawn_config_new.";
+ emsg = "winpty_spawn_config_new failed";
goto cleanup;
}
@@ -128,9 +128,9 @@ int pty_process_spawn(PtyProcess *ptyproc)
&err)) {
if (win_err) {
status = (int)win_err;
- emsg = "Failed spawn process.";
+ emsg = "failed to spawn process";
} else {
- emsg = "Failed winpty_spawn.";
+ emsg = "winpty_spawn failed";
}
goto cleanup;
}
@@ -160,11 +160,11 @@ int pty_process_spawn(PtyProcess *ptyproc)
cleanup:
if (status) {
// In the case of an error of MultiByteToWideChar or CreateProcessW.
- ELOG("%s error code: %d", emsg, status);
+ ELOG("%s: error code: %d", emsg, status);
status = os_translate_sys_error(status);
} else if (err != NULL) {
status = (int)winpty_error_code(err);
- ELOG("%s error code: %d", emsg, status);
+ ELOG("%s: error code: %d", emsg, status);
status = translate_winpty_error(status);
}
winpty_error_free(err);
@@ -308,7 +308,7 @@ static int build_cmd_line(char **argv, wchar_t **cmd_line, bool is_cmdexe)
}
}
- int result = utf8_to_utf16(utf8_cmd_line, cmd_line);
+ int result = utf8_to_utf16(utf8_cmd_line, -1, cmd_line);
xfree(utf8_cmd_line);
return result;
}