FAR Commands plugin does not use configured command interpreter
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
- Make sure Far is configured with a command interpreter which is different from the system command interpreter
%ComSpec%. You can do this by runningfar:configand configuringSystem.Executor.Comspecwith the full path of the command interpreter. - Run the
vercommand from the command line in Far, and take note of the output usingCtrl+O. You can run any internal command as long as the output is different when run from the system command interpreter. - Run
edit:<verand 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.
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.
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.
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.
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.
Do you still plan to fix this for Far commands plugin?
Yes, the plugin should read the Far setting and act accordingly.
That would be great. Thank you.