Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^4: Capturing bash output without displaying STOUT in terminal

by Linicks (Scribe)
on Sep 08, 2016 at 17:16 UTC ( #1171417=note: print w/replies, xml ) Need Help??


in reply to Re^3: Capturing bash output without displaying STOUT in terminal
in thread Capturing bash output without displaying STOUT in terminal

I tried this, and it doesn't work for 'git fetch --tags' for some reason.

My guess is that using this command produces some sort of 'active' output (for want of a better description) in the terminal, and it isn't a static output like you would get from backticks 'ls' or 'ps ax' etc.

Now for some reason, once you run 'git fetch --tags', any other time you run it, there is no output - I don't know how to reset it to test - but maybe try saving the command in a text file chmod 755 gitfetch.sh and then use

my $git = `.\gitfetch.sh`;

BTW, using 'my $git = `git status`; works:

:~/git/claws/claws$ perl gittest What's here? --- On branch master Your branch is up-to-date with 'origin/master'. Untracked files: (use "git add <file>..." to include in what will be committed) gittest nothing added to commit but untracked files present (use "git add" to +track)

Nick

Replies are listed 'Best First'.
Re^5: Capturing bash output without displaying STOUT in terminal [SOLVED]
by Linicks (Scribe) on Sep 08, 2016 at 18:14 UTC

    OK, first I had to suss out git to clear tags so I could test:

    git tag -d $(git tag)

    does it.

    Now, as assumed, output goes somewhere else, so:

    #!/usr/bin/perl use warnings; use strict; my $git; $git = `git fetch --tags 2>&1`; print "What's here? --- $git\n";

    sorts it.

    Nick

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1171417]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2023-05-30 18:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?