History resetting itself

Aug 31, 2011
13
0
#1
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?
 

rconn

Administrator
Staff member
May 14, 2008
10,506
94
#2
My history is reset after I run certain commands and I lose all my recent command history.
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).
 
Aug 31, 2011
13
0
#3
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?
 

rconn

Administrator
Staff member
May 14, 2008
10,506
94
#7
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?
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
 
Aug 31, 2011
13
0
#8
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
 

rconn

Administrator
Staff member
May 14, 2008
10,506
94
#9
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
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.)