[geany/geany] 3566ba: Alter printing.c to use the new spawning module

Dimitar Zhekov git-noreply at xxxxx
Fri May 15 17:07:36 UTC 2015


Branch:      refs/heads/master
Author:      Dimitar Zhekov <dimitar.zhekov at gmail.com>
Committer:   Dimitar Zhekov <dimitar.zhekov at gmail.com>
Date:        Sat, 21 Mar 2015 17:58:11 UTC
Commit:      3566baa60861933435dff39fadcb82693ea95a25
             https://github.com/geany/geany/commit/3566baa60861933435dff39fadcb82693ea95a25

Log Message:
-----------
Alter printing.c to use the new spawning module


Modified Paths:
--------------
    src/printing.c

Modified: src/printing.c
19 lines changed, 9 insertions(+), 10 deletions(-)
===================================================================
@@ -39,6 +39,7 @@
 #include "highlighting.h"
 #include "msgwindow.h"
 #include "sciwrappers.h"
+#include "spawn.h"
 #include "support.h"
 #include "utils.h"
 #include "ui_utils.h"
@@ -602,16 +603,15 @@ static void print_external(GeanyDocument *doc)
 			doc->file_name, cmdline))
 	{
 		GError *error = NULL;
-
-#ifdef G_OS_WIN32
-		gchar *tmp_cmdline = g_strdup(cmdline);
-#else
 		/* /bin/sh -c emulates the system() call and makes complex commands possible
-		 * but only needed on non-win32 systems due to the lack of win32's shell capabilities */
-		gchar *tmp_cmdline = g_strconcat("/bin/sh -c \"", cmdline, "\"", NULL);
-#endif
-
-		if (! g_spawn_command_line_async(tmp_cmdline, &error))
+		 * but only on non-win32 systems due to the lack of win32's shell capabilities */
+	#ifdef G_OS_UNIX
+		gchar *argv[] = { "/bin/sh", "-c", cmdline, NULL };
+
+		if (!spawn_async(NULL, NULL, argv, NULL, NULL, &error))
+	#else
+		if (!spawn_async(NULL, cmdline, NULL, NULL, NULL, &error))
+	#endif
 		{
 			dialogs_show_msgbox(GTK_MESSAGE_ERROR,
 				_("Printing of \"%s\" failed (return code: %s)."),
@@ -622,7 +622,6 @@ static void print_external(GeanyDocument *doc)
 		{
 			msgwin_status_add(_("File %s printed."), doc->file_name);
 		}
-		g_free(tmp_cmdline);
 	}
 	g_free(cmdline);
 }



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list