I'm trying to execute a git command from perl via IPC::Run which catches STDOUT/STDERR-Output from git in perl variables.
Here is what i did:
use strict;
use warnings;
use IPC::Run;
my $stderr, $stdout, @cmd;
push @cmd, "git";
push @cmd, "clone";
push @cmd, "http://my.gitserver.com/scm/tst2/abc.git";
my $success = IPC::Run::run \@cmd, '>', \$stdout, '2>', \$stderr;
1;
Running this results in:
- $stdout: Cloning into 'abc'...
- $stderr: EMPTY
Running git command from commandline directly results in following output:
$ git clone http://my.gitserver.com/scm/tst2/abc.git
Cloning into 'abc'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
As you can see, git produces some more output on commandline than I actually capture within my perl implementation.
What's going wrong?
git
to output it. Note that it will surely contain many terminal control characters (carriage returns and backspaces). – ikegami$stderr
is empty after my call ... UsingGit::Repository
module is not easily usable in my case (as my "server" gets the command to execute from a remote machine and writes the result to a shared sandbox - the received commands can be "anything" - not only git commands ... @ikegami: Have no idea yet how to do this ... – hoppfrosch