Skip to content

Commit

Permalink
Alter printing.c to use the new spawning module
Browse files Browse the repository at this point in the history
  • Loading branch information
zhekov committed Mar 21, 2015
1 parent 353b748 commit 3566baa
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/printing.c
Expand Up @@ -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"
Expand Down Expand Up @@ -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)."),
Expand All @@ -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);
}
Expand Down

0 comments on commit 3566baa

Please sign in to comment.