Re: Run an external program and capture its output
[email protected] (John Emmas) Thu, 17 Apr 2014 10:51:56 +0100
| Newsgroups | perl.win32.vanilla |
|---|---|
| Message-ID | <[email protected]> |
On 17/04/2014 10:02, John Emmas wrote:
> if I run this command (directly from a DOS Command Prompt) it does
> populate 'test.txt' with the expected output:-
>
> gtk-update-icon-cache --force --ignore-theme-index --source
> builtin_icons gtk/stock-icons > test.txt
>
> So in other words, the actual command is valid. It works when run
> from a command line but I can't seem to make it work from a perl
> script :-(
>
FWIW this command sequence in my perl script seems to work!
use IPC::Run3;
my $output;
run3(["gtk-update-icon-cache", "--force",
"--ignore-theme-index", "--source", "builtin_icons", "gtk/stock-icons"],
\undef, "test.txt");
Does that seem like a reasonable solution? So far, I've only tested it
on Windows XP (one of the platforms where it wasn't previously
working). I'll need to re-test it on Win7 and Win8.
John