mcfly icon indicating copy to clipboard operation
mcfly copied to clipboard

mcfly.bash leaves behind the /tmp/ temporary files

Open grinapo opened this issue 5 years ago • 12 comments

$ ls -la /tmp/mcfly.* |wc -l
130

grinapo avatar Nov 18 '19 12:11 grinapo

/tmp should get cleaned up on restart.

cantino avatar Nov 20 '19 01:11 cantino

We talk about large amounts of tmp files, in the magnitude of thousands.

grinapo avatar Nov 29 '19 10:11 grinapo

Huh, that's odd. Are you opening and closing many terminal windows?

cantino avatar Dec 06 '19 01:12 cantino

Ermm... yes? :-)

$ ps awuxf | grep xterm|wc -l
64

grinapo avatar Dec 06 '19 10:12 grinapo

Hmm, if you close terminals with exit, we could do this:

function mcfly_cleanup {
  if [ ! -z "${MCFLY_HISTORY}" ] && [[ -f "${MCFLY_HISTORY}" ]]; then
    rm "${MCFLY_HISTORY}"
  fi
}

trap mcfly_cleanup EXIT

If you use the UI, though, I'm not sure how to hook into cleanup. On my Mac, closing a Terminal doesn't seem to run .bash_logout. What about on your system?

cantino avatar Dec 09 '19 23:12 cantino

Nope, there is no sign of it in strace, either. trap works well, and I guess it works in most (all?) shells, not just bash.

grinapo avatar Dec 22 '19 09:12 grinapo

Currently I have 14 mcfly.* files in /tmp. All of them have today's timestamp. It's first time I'm noticing it but doesn't mean much as I do not check /tmp that often :) . Using McFly 0.3.5.

hegerj avatar Mar 16 '20 15:03 hegerj

These should get cleaned up when your system is restarted, right?

cantino avatar Mar 29 '20 22:03 cantino

They did but immediately after booting there are bunch of new ones.

hegerj avatar Mar 30 '20 06:03 hegerj

Are they all identical?

cantino avatar Mar 30 '20 16:03 cantino

no, each is different (not sure about each, I compared random few which were different)

hegerj avatar Mar 31 '20 05:03 hegerj

It would be nice to include the cleanup function and trap in the bash code generated by mcfly init bash.

waldner avatar Sep 07 '21 13:09 waldner