patchmake - Patches: patch #6911, Ability to detect interactive...

 
 

You are not allowed to post comments on this tracker with your current authentification level.

patch #6911: Ability to detect interactive shell (isatty())

Submitted by:  Mark <mtrinh>
Submitted on:  Tue 08 Sep 2009 04:46:16 PM UTC  
 
Category: NonePriority: 5 - Normal
Status: NonePrivacy: Public
Assigned to: NoneOpen/Closed: Open
Fixed Release: None

Sun 13 Sep 2009 07:02:55 PM UTC, comment #3:

sorry, it should be like this:

ifeq "$(MAKE_ISSATTY)" "1"

all:
@echo "\033[33mHi\033[0m"

else

all:
@echo "Hi"

endif

Mark <mtrinh>
Sun 13 Sep 2009 05:00:23 PM UTC, comment #2:

It's useful when we are outputting colors in the terminal during a build. For example, the below code would only output colors when it is in an interactive terminal. If you redirect the output to a file, then it wont output the escape characters in your file. (not sure if the "ifeq" statement is written correctly. :) Hope this helps.

gmake vs gmake > out.txt

ifeq "$(MAKE_ISSATTY)" "1"

all:
@echo "\033[33mHi\033[0m"

else

all:
@echo "\033[33mHi\033[0m"

endif

Mark <mtrinh>
Sat 12 Sep 2009 10:35:59 PM UTC, comment #1:

Can you give me some idea of why this is useful information / what it's useful for? Thanks!

Paul D. Smith <psmith>
Project Administrator
Tue 08 Sep 2009 04:46:16 PM UTC, original submission:

There are times where I need to figure out if the current shell is interactive or not. This patch introduces an environment macro called MAKE_ISATTY, which returns either a 1 or 0.

This calls isatty on stdout to figure out if you are redirecting make to a file (ie. make > foo) or not.

This patch is off of the version from CVS.

Mark <mtrinh>

 

Attached Files
file #18689:  tty.patch added by mtrinh (600B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by psmith (Posted a comment)
  • -unavailable- added by mtrinh (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 08 Sep 2009 04:46:16 PM UTCmtrinhAttached File-=>Added tty.patch, #18689

    Back to the top


    Powered by Savane 3.1-cleanup