Re: [code] [textadept] a struggle across 32/64 toolchains

From: Mitchell <m.att.foicica.com>
Date: Mon, 8 Aug 2016 09:48:07 -0400 (EDT)

Hi Gennadiy,

On Sun, 7 Aug 2016, Gennadiy Poryev wrote:

> [snip]
> It turned out that since my Windows is 64-bit, the WSL is exclusively 64-bit
> only. 32-bit version of its native CMD shell does not know anything about
> WSL, bash, ssh etc. So I can't just write something like this:
>
> textadept.run.run_commands.rust = 'bash.exe --verbose -c "ssh root.att.1.2.3.4
> \'cd myproject; cargo run\'"'
>
> Because bash.exe is exclusively 64-bit, and by MS design it cannot be found
> from 32-bit cmd.exe.
> Apparently TextAdept just calls Lua spawn() function for that; I suppose, Lua
> then just starts what's in COMSPEC environment with "/c" and whatever
> follows. For Win32 TextAdept on Win64 host this would obviously be 32-bit
> cmd.exe hence the first problem.

Yes, Textadept utilizes the COMSPEC environment variable followed by "/c".

> [snip]
> Having said all that, my questions are:
> 1. Is it too bold to anticipate Win64 builds of TextAdept? That would solve
> all the problems instantly. We're in 2016 after all...

There are two reasons why I do not anticipate 64-bit Windows builds in the
near future: (1) LuaJIT still does not cross-compile against MinGW64 on
Linux, which is needed on my build server (2) My build server is 32-bit
and upgrading to 64-bit is not something I'm comfortable with, as the
build server also hosts this domain, mailing lists, etc. I don't trust
myself to not break things :(

> 2. Is it possible to override which and how command interpreter is called in
> Lua spawn()?

As I alluded to earlier, if you can change the value of the COMSPEC
environment variable, you can trick Textadept into using it while keeping
the actual value in Windows unchanged. First try changing the environment
variable in Windows and see if that works (I don't know what you'd change
it to though, as I'm not a Windows developer). If it works, then change it
back and define a new function in your `~/.textadept/init.lua`:

   local os_getenv = os.getenv
   os.getenv = function(var)
     if var == 'COMSPEC' then
       -- return your custom value
     end
     return os_getenv(var)
   end

The Lua spawn function internally calls `os.getenv()` to get the value of
COMSPEC, then appends "/c" followed by the command. There is no way to
override it otherwise.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Mon 08 Aug 2016 - 09:48:07 EDT

This archive was generated by hypermail 2.2.0 : Tue 09 Aug 2016 - 06:40:30 EDT