1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

History resetting itself

Discussion in 'Support' started by wcfi, Dec 12, 2011.

  1. wcfi

    Joined:
    Aug 31, 2011
    Messages:
    13
    Likes Received:
    0
    My history is reset after I run certain commands and I lose all my recent command history.

    For example, I use "windres -o whatever.o whatever.rc" (windres is in the tdm-gcc-4.6.1 package from http://tdm-gcc.tdragon.net/download) and my history is reset to whatever it was before I opened the shell and windres isn't in the history. (windres spawns gcc..).

    Is there a way to fix this?
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,863
    Likes Received:
    83
    First, are you using local or global command history? What version of Take Command / TCC are you running? Are you running TCC in a Take Command tabbed window or in a stand-alone console?

    The only way that the history list can be cleared is if you've got a HISTORY command somewhere -- in your TCSTART, in your PRE_INPUT, PRE_EXEC, or POST_EXEC aliases, or if you're starting secondary shells and you've defined an autoload history file (OPTION / Command Line / History File).
     
  3. wcfi

    Joined:
    Aug 31, 2011
    Messages:
    13
    Likes Received:
    0
    I have a History File set (OPTION / Command Line / History File), I am using TCC from within Take Command 13, and all my Local lists (OPTION / Startup) are Unchecked as I'd like a global history. I do not have a HISTORY command in TCSTART.

    I guess windres is starting secondary shells to spawn gcc, but I want to keep a history file without it being reset. What can I do?
     
  4. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    648
    Likes Received:
    1
  5. wcfi

    Joined:
    Aug 31, 2011
    Messages:
    13
    Likes Received:
    0
    Ok, but is there any reliable workaround for the time being?
     
  6. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    648
    Likes Received:
    1
    You can use local history. Or, you can handle the history file yourself in your tcstart.btm and tcexit.btm.
     
  7. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,863
    Likes Received:
    83
    The history file in its current incarnation is not really intended to be used with global history lists or when spawning multiple secondary shells. (Actually a bit of a misnomer, since as far as Windows is concerned there isn't such a thing as a secondary shell.) I'd recommend putting a HISTORY /R in your TCSTART, and conditioning it based on whether you're in a transient shell; i.e. something like:

    if %_transient == 0 history /r historyfile
     
  8. wcfi

    Joined:
    Aug 31, 2011
    Messages:
    13
    Likes Received:
    0
    Should I be saving this global history in TCEXIT or would that also cause overwrite problems with multiple tcc tabs when they close?
    history > historyfile
     
  9. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,863
    Likes Received:
    83
    If you're using global history lists, you can save it to a file in TCEXIT. If you're using local lists, it would be a Very Bad Thing. (Unless you use a different file for each tab.)
     

Share This Page