Page 1 of 1
%L does not create tmp list file with conemu
Posted: 2024-11-12, 09:27 UTC
by sergiokapone
I am using Total Commander (11.50b5x64, Win10 19045.2673) with
ConEmu (latest) as my console emulator. In ConEmu, I have enabled the S
ettings -> Integration-> Default Term "
Use existing ConEmu window if avaliable" option. This allows new console commands to open in an existing ConEmu tab if one is already open. I frequently run console applications from Total Commander via button configurations that use the %L parameter, which generates a temporary file containing the list of selected files.
Problem:
When the "
Use existing ConEmu window if avaliable" option is enabled, and the first tab in ConEmu already is launched the temporary file (e.g., C:\Temp\CMDxxxx.tmp) for %L is not created. As a result, the console application in ConEmu reports an error indicating that it cannot find the temporary file.
Example of button configuration in Total Commander:
Code: Select all
TOTALCMD#BAR#DATA
cmd /k type
%L
imageres.dll
-1
Expected Behavior:
The temporary %L file should be created correctly in any new ConEmu tab, regardless of the shell in the first tab or the status of the "
Use existing ConEmu window if avaliable" option.
Question:
Is there a way to resolve or work around this issue so that the %L temporary file is always created correctly with ConEmu’s "
Use existing ConEmu window if avaliable" option enabled?
Image:
https://i.imgur.com/29H3672.gif
Re: %L does not create tmp list file with conemu
Posted: 2024-11-12, 10:36 UTC
by white
I tested this with Windows Terminal and it worked fine. So it seems to be a problem with ConEmu.
Perhaps ConEmu creates a new process and kills the original one, resulting in TC deleting the temp file.
A workaround could be to copy the temp file to your own temp file before launching ConEmu. And delete that temp file afterwards yourself.
Re: %L does not create tmp list file with conemu
Posted: 2024-11-12, 10:45 UTC
by sergiokapone
Did you test Windows Terminal with creating a tab in an existing terminal window, or did you create a new window?
Re: %L does not create tmp list file with conemu
Posted: 2024-11-12, 11:45 UTC
by white
sergiokapone wrote: 2024-11-12, 10:45 UTC
Did you test Windows Terminal with creating a tab in an existing terminal window, or did you create a new window?
In an existing terminal window of course. That's what your report is about.
Re: %L does not create tmp list file with conemu
Posted: 2024-11-12, 15:45 UTC
by ghisler(Author)
When the "Use existing ConEmu window if avaliable" option is enabled
That's the problem, the parameters are passed to ConEmu either via DDE, or a second copy of ConEmu which immediately terminates. Once the called program terminates, the temporary file list is deleted immediately. This probably happens before ConEmu has a chance to read it.
Re: %L does not create tmp list file with conemu
Posted: 2024-11-12, 17:48 UTC
by sergiokapone
I noticed another strange peculiarity: if you repeatedly press the button on selected files, there are cases of correct triggering and the list works. The probability is <50% but still not zero.
Re: %L does not create tmp list file with conemu
Posted: 2024-11-12, 17:58 UTC
by sergiokapone
2ghisler(Author)
Is it possible to put some kind of delay on deleting a temporary file or not?
Re: %L does not create tmp list file with conemu
Posted: 2024-11-13, 10:22 UTC
by ghisler(Author)
It could be done, the question is just "how". It could be an ini file setting, but then it would apply to all programs, but they may require different delays. Or a parameter for the command line?
Re: %L does not create tmp list file with conemu
Posted: 2024-11-13, 11:20 UTC
by white
Another solution could be to add an option to not delete the temp file at all, but to leave it up to the user to delete the file.
Re: %L does not create tmp list file with conemu
Posted: 2024-11-13, 11:46 UTC
by ghisler(Author)
Bad idea, this would flood the temp directory with temporary files. The timeout is a better idea. Alternatively the same temp file could be re-used multiple times, but this would clash with multiple parallel background operations.
Re: %L does not create tmp list file with conemu
Posted: 2024-11-13, 12:35 UTC
by petermad
How about just deleting tmp files when exiting TC? - Or when starting TC, that would also delete tmp files left after a TC crash.
TC would have to lock currently used tmp files so they would not be deleted when closing or opening other instances of TC.
Re: %L does not create tmp list file with conemu
Posted: 2024-11-13, 13:32 UTC
by white
ghisler(Author) wrote: 2024-11-13, 11:46 UTC
Bad idea, this would flood the temp directory with temporary files. The timeout is a better idea.
I disagree. It would be an option the user specifically chooses, so if it floods the temp folder, that's what the user wants. He will clean up the files when he wants to clean them up. A timeout feature is an unreliable workaround. For whatever reason the started process may take longer, in which case the file is no longer available and things may go haywire.
Re: %L does not create tmp list file with conemu
Posted: 2024-11-13, 14:48 UTC
by ghisler(Author)
deleted when closing or opening other instances of TC
When closing would be an alternative, because each instance would only remove the files it created.
When opening would be problematic when the user opens a second or third instance, it would delete all the temp files of the still running instances.
Re: %L does not create tmp list file with conemu
Posted: 2024-11-13, 19:38 UTC
by petermad
When opening would be problematic when the user opens a second or third instance, it would delete all the temp files of the still running instances.
That is why I suggested to lock the tmp files to each TC instance - if that is feasible.
Re: %L does not create tmp list file with conemu
Posted: 2024-11-14, 08:07 UTC
by ghisler(Author)
Not really - tmp files created via Windows function only support a short 3 character prefix which can be set by the calling app, the rest are random characters. Also other apps may use the same prefix CMD as I do. Then Total Commander would delete other program's TEMP files, which would be very bad. Also temp files would be gone when using somthing like cm_exit 9.
Anyway, since this isn't really a bug, I will move this to the suggestions forum. Maybe I will get some more suggestions from there.
Moderator message from: ghisler(Author) » 2024-11-14, 08:07 UTC
Moved to suggestions