FarManager icon indicating copy to clipboard operation
FarManager copied to clipboard

FAR Commands plugin does not use configured command interpreter

Open rohitab opened this issue 3 years ago • 6 comments

Far Manager version

3.0.6074.0 x64

OS version

10.0.22623.1037

Other software

You will need a second command interpreter. If you don't have one installed, you can use TCC/LE, which is free.

Steps to reproduce

  1. Make sure Far is configured with a command interpreter which is different from the system command interpreter %ComSpec%. You can do this by running far:config and configuring System.Executor.Comspec with the full path of the command interpreter.
  2. Run the ver command from the command line in Far, and take note of the output using Ctrl+O. You can run any internal command as long as the output is different when run from the system command interpreter.
  3. Run edit:<ver and note the output shown in the Editor

Expected behavior

Output of ver and edit:<ver commands is the same

Actual behavior

Output of ver and edit:<ver is different. The output of ver is from the configured command interpreter System.Executor.Comspec The output of edit:<ver is from the system command interpreter %ComSpec%

This can get confusing since the same command can behave differently when the output is redirected using Far Commands plugin. In other cases, one command can fail while the other succeeds, due to the command only being supported in one interpreter.

rohitab avatar Dec 22 '22 08:12 rohitab

This can get confusing

Indeed, we should fix this. Note, however, that System.Executor.Comspec was added to cover rather arcane cases, e.g. people using truly alien shell replacements like bash. For something mostly compatible with cmd, like TCC/LE in your example, overriding the %comspec% variable itself should work fine.

alabuzhev avatar Dec 22 '22 17:12 alabuzhev

Based on the configuration files like Executor.TCC.farconfig in %FARHOME%\Addons\SetUp, I assumed that System.Executor.Comspec was the correct way to modify the command interpreter.

How would you recommend changing %ComSpec% just for Far, without modifying the environment variable for other applications? I guess I could use an auto-start macro to modify %ComSpec%, but I'm not sure if that's the right way.

Actually, I was just thinking. Shouldn't Far modify %ComSpec% automatically if System.Executor.Comspec is configured? That would fix the issue and wouldn't require any additional changes in plugins.

rohitab avatar Dec 23 '22 16:12 rohitab

I could use an auto-start macro

That or start Far from a bat/cmd file that would modify the environment accordingly first.

Shouldn't Far modify %ComSpec% automatically if System.Executor.Comspec is configured?

Not really, that would undermine the whole reason of its existence. As I mentioned earlier, people wanted to use exotic interpreters, tried updating %compspec% accordingly and then discovered that:

  • %comspec% is also used to execute bat & cmd files, and, unsurprisingly, exotic interpreters like bash don't know much about bat & cmd files
  • it affects child processes too, which is not always desirable.

The parameter was added exactly to allow replacing the interpreter without touching the variable.

alabuzhev avatar Dec 23 '22 20:12 alabuzhev

I see your point. Child processes would definitely be a problem.

Indeed, we should fix this.

Do you still plan to fix this for Far commands plugin? If not, I'll close this ticket.

rohitab avatar Dec 24 '22 13:12 rohitab

Do you still plan to fix this for Far commands plugin?

Yes, the plugin should read the Far setting and act accordingly.

alabuzhev avatar Dec 24 '22 14:12 alabuzhev

That would be great. Thank you.

rohitab avatar Dec 25 '22 16:12 rohitab