GNOME Bugzilla – Bug 626020
Console window opening on file-ps-load
Last modified: 2012-05-30 15:48:45 UTC
When using file-ps-load on WinXP from the script-fu console or from gimp batch-mode, there is a DOS-Box (cmd-window) popping up. It is empty and disappears without further user interaction. I think it's triggered by the call of gswin32c.exe. The call of file-ps-load itself works as expected, but the "pop-up" is very annoying when gimp is called in batch mode while your doing something else on the computer (like writing an email -> the mail editor window loses its focus every time file-ps-load is called in the background). We discussed this on #gimp irc where schumaml guessed it might be related to the flags used here: http://git.gnome.org/browse/gimp/tree/plug-ins/common/file-ps.c#n1763 ff. (adding G_SPAWN_STDOUT_TO_DEV_NULL and G_SPAWN_STDERR_TO_DEV_NULL?)
That would most probably fix the problem. Please try this change and report back. Preferably attach a patch here.
I'm sorry... I *might* be able to somehow figure out how to change the code, but I'm definitly not able to compile Gimp on windows (using windows only at work, where I'm not allowed to install additional tools).
Is't not a "DOS Box". It has nothing to do with (MS-)DOS. Just call it a "console window" which is the correct and meaningful term. Anyway no, I doubt using the flags mentioned will help. There currently is no way to avoid a console window when running an exe file marked as being a "console" executable using the g_spawn*() APIs. (There is a bug open that suggests adding a flag for that, but it has been slow to progress, partly I can take the blame for that.) Instead, the code should perhaps run gswin32.exe and not gswin32c.exe, if there is a such, I don't have Ghostscript right now on my Windows machine to check. Can you check if I recall correctly, does Ghostscript also come with a gswin32.exe, and does the console window go away if you set the environment variable GS_PROG to gswin32.exe? (And make sure that too is found in PATH.) Although, there is a comment in the code that says "We want the console ghostscript application", so maybe that won't help, maybe gswin32.exe doesn't take command-line parameters as gswin32c.exe does.
Nevertheless, the g_spawn*() docs mention that these flags should be set if stdout and stderr are set to NULL.
@Tor: I tried using gswin32.exe. The call works as expected (so the command-line parameters seem to be the same for at least my use case), but there also is a window coming up. It's not a console window, but an all white window with "gswin32.exe" (or without the .exe?) as its title. This window also disappears without user interaction. As such, using gswin32.exe doesn't really improve things, but maybe for this exe the flags would help (just a guess, not really understanding what's going on behind the scenes...)? (In reply to comment #3)
commit fe7b253512a9286aa6ff6b24c873fa5d27342be7 Author: Michael Schumacher <schumaml@gmx.de> Date: Thu Aug 12 21:40:40 2010 +0200 Bug 626020 - Console window opening on file-ps-load Added G_SPAWN_STDOUT_TO_DEV_NULL and G_SPAWN_STDERR_TO_DEV_NULL to the g_spawn_sync () flags. According to Tor Lillqvist this won't fix the bug, but the GLib docs state that these flags have to be added if stdout and stderr are set to NULL.
And for gimp-2-6 as well: commit 608a680240eb4a10e718cdb4ac8e17e70c695312 Author: Michael Schumacher <schumaml@gmx.de> Date: Thu Aug 12 21:40:40 2010 +0200 Bug 626020 - Console window opening on file-ps-load Added G_SPAWN_STDOUT_TO_DEV_NULL and G_SPAWN_STDERR_TO_DEV_NULL to the g_spawn_sync () flags. According to Tor Lillqvist this won't fix the bug, but the GLib docs state that these flags have to be added if stdout and stderr are set to NULL.
Please try GIMP 2.7.4 and report back, we won't fix 2.6 bugs any longer.
Could you please try to reproduce problem with GIMP 2.7.4 or later version and update the bug report with your findings, tia.
I'm really sorry, but I do not have a windows installation of gimp 2.7.4 or later available. As mentioned above, I'm using windows only at work and as of today, they only have gimp 2.6.6 installed:( There was no special environment needed to reproduce the bug, so maybe somebody with a windows environment (that he has admin rights for) can try to reproduce it with 2.6 and confirm solution with 2.7.4?
I think this should be tested with an version newer then 2.7.4, because the move to libgv was after the 2.7.4 release. I'm not able to compile Gimp on Windows, but if someone could point me to a setup with the changes to libgv, I could test it.
I've tried to test it with 2.7.5 (Windows 7), but I'm not sure if this bug is fixed because in the developer versions is always an console window open.
Opening PS-Files with the file open dialogue, I don't get a console window. What do I need to enter in the script-fu console to test this?
The following should create a png file from your postscript and pop up the console window: (begin (define infile "c:\path\to\picture.ps") (define outfile "c:\path\to\picture.png") (file-ps-load-setargs 200 0 0 1 "1" 6 4 4) (let* ( (img (car (file-ps-load 1 infile infile))) (drw (car (gimp-image-active-drawable img)))) (file-png-save 1 img drw outfile outfile 0 1 0 0 0 0 0))) I got a new PC at work and was not able to test this again because GIMP said it couldn't start gswin32c.exe even though %GS_PROG% is set and valid. I verified the syntax here at home with gimp 2.6.8 (linux).
Now that there is a 2.8.0, this can be tested without the standard console window of the development versions.
I've tested it with Gimp 2.8.0 on my Windows 7 system and I haven't seen any console window. I think we can close this bug as fixed.