%L does not create tmp list file with conemu

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
sergiokapone
Junior Member
Junior Member
Posts: 39
Joined: 2017-01-17, 07:45 UTC

%L does not create tmp list file with conemu

Post 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 Settings -> 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
Russian Language of Total Commander
Windows 10 Core 10.0 (Build 19045), base: 0400000
User avatar
white
Power Member
Power Member
Posts: 5744
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: %L does not create tmp list file with conemu

Post 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.
sergiokapone
Junior Member
Junior Member
Posts: 39
Joined: 2017-01-17, 07:45 UTC

Re: %L does not create tmp list file with conemu

Post by *sergiokapone »

Did you test Windows Terminal with creating a tab in an existing terminal window, or did you create a new window?
Russian Language of Total Commander
Windows 10 Core 10.0 (Build 19045), base: 0400000
User avatar
white
Power Member
Power Member
Posts: 5744
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: %L does not create tmp list file with conemu

Post 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.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: %L does not create tmp list file with conemu

Post 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.
Author of Total Commander
https://www.ghisler.com
sergiokapone
Junior Member
Junior Member
Posts: 39
Joined: 2017-01-17, 07:45 UTC

Re: %L does not create tmp list file with conemu

Post 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.
Russian Language of Total Commander
Windows 10 Core 10.0 (Build 19045), base: 0400000
sergiokapone
Junior Member
Junior Member
Posts: 39
Joined: 2017-01-17, 07:45 UTC

Re: %L does not create tmp list file with conemu

Post by *sergiokapone »

2ghisler(Author)

Is it possible to put some kind of delay on deleting a temporary file or not?
Russian Language of Total Commander
Windows 10 Core 10.0 (Build 19045), base: 0400000
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: %L does not create tmp list file with conemu

Post 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?
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 5744
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: %L does not create tmp list file with conemu

Post 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.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: %L does not create tmp list file with conemu

Post 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.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 15997
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: %L does not create tmp list file with conemu

Post 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.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
white
Power Member
Power Member
Posts: 5744
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: %L does not create tmp list file with conemu

Post 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.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: %L does not create tmp list file with conemu

Post 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.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 15997
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: %L does not create tmp list file with conemu

Post 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.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: %L does not create tmp list file with conemu

Post 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
Author of Total Commander
https://www.ghisler.com
Post Reply