You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by fu...@apache.org on 2020/10/04 14:24:57 UTC

svn commit: r1882235 - /subversion/trunk/subversion/libsvn_subr/cmdline.c

Author: futatuki
Date: Sun Oct  4 14:24:57 2020
New Revision: 1882235

URL: http://svn.apache.org/viewvc?rev=1882235&view=rev
Log:
Follow up to r1882234: Fix file name to edit to Unicode on Windows.

* subversion/libsvn_subr/cmdline.c
  (svn_cmdline__edit_file_externally, svn_cmdline__edit_string_externally):
  Use _wsystem() instead of system() on Windows environment.

Modified:
    subversion/trunk/subversion/libsvn_subr/cmdline.c

Modified: subversion/trunk/subversion/libsvn_subr/cmdline.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/cmdline.c?rev=1882235&r1=1882234&r2=1882235&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/cmdline.c (original)
+++ subversion/trunk/subversion/libsvn_subr/cmdline.c Sun Oct  4 14:24:57 2020
@@ -1406,6 +1406,9 @@ svn_cmdline__edit_file_externally(const
 {
   const char *editor, *cmd, *base_dir, *file_name, *base_dir_apr;
   const char *file_name_local;
+#ifdef WIN32
+  const WCHAR *wcmd;
+#endif
   char *old_cwd;
   int sys_err;
   apr_status_t apr_err;
@@ -1434,7 +1437,12 @@ svn_cmdline__edit_file_externally(const
   /* editor is explicitly documented as being interpreted by the user's shell,
      and as such should already be quoted/escaped as needed. */
   cmd = apr_psprintf(pool, "%s %s", editor, file_name_local);
+#ifndef WIN32
   sys_err = system(cmd);
+#else
+  SVN_ERR(svn_utf__win32_utf8_to_utf16(&wcmd, cmd, NULL, pool));
+  sys_err = _wsystem(wcmd);
+#endif
 
   apr_err = apr_filepath_set(old_cwd, pool);
   if (apr_err)
@@ -1466,6 +1474,9 @@ svn_cmdline__edit_string_externally(svn_
 {
   const char *editor;
   const char *cmd;
+#ifdef WIN32
+  const WCHAR *wcmd;
+#endif
   apr_file_t *tmp_file;
   const char *tmpfile_name;
   const char *tmpfile_native;
@@ -1607,7 +1618,12 @@ svn_cmdline__edit_string_externally(svn_
     }
 
   /* Now, run the editor command line.  */
+#ifndef WIN32
   sys_err = system(cmd);
+#else
+  SVN_ERR(svn_utf__win32_utf8_to_utf16(&wcmd, cmd, NULL, pool));
+  sys_err = _wsystem(wcmd);
+#endif
   if (sys_err != 0)
     {
       /* Extracting any meaning from sys_err is platform specific, so just