Floobits / atom-term3

Open Terminal tabs in Atom. Fork of Term package
Other
88 stars 17 forks source link

Problems installing atom-term3 on Windows - solved with some modifications #40

Closed vuki closed 8 years ago

vuki commented 8 years ago

Hello. I've been trying to install atom-term3 on Windows 7. I've succeeded after some hacking into code. I'm writing this as a sugestion to make some code changes to allow other Windows users install the module.

Problem 1: pty.js does not compile on Windows. Solved by replacing pty.js with ptyw.js:

I don't know if ptyw can be used instead of pty on Mac and Linux though.

Problem 2: after loading Atom, I get the following error: TypeError: Cannot read property 'toLowerCase' of undefined at file:///C:/Users/Greg/.atom/packages/atom-term3/index.coffee:109:33

This results from this code:

    default: do ({SHELL, HOME}=process.env) ->
      switch path.basename SHELL.toLowerCase()

On Windows, SHELL variable is not defined, hence toLowerCase generates the error.

Dirty fix:

  shellArguments:
    type: 'string'
    default: do ({SHELL, HOME}=process.env) ->
      if process.platform is not 'win32'
        switch path.basename SHELL.toLowerCase()
          when 'bash' then "--init-file #{path.join HOME, '.bash_profile'}"
          when 'zsh'  then "-l"
          else ''
      else ''

Problem 3: error in console after starting the terminal:

File not found: C:\Windows\WindowsPowerShell\v1.0\powershell.exe 
Error: File not found: C:\Windows\WindowsPowerShell\v1.0\powershell.exe

This path is hardcoded in pty.coffee, line 12:

        shell = path.resolve(process.env.SystemRoot, 'WindowsPowerShell', 'v1.0', 'powershell.exe')`

There is no such path on my PC. Besides, it is sufficient to enter 'powershell.exe', it will be found. And also besides, i much prefer using cmd.exe. Hence changing the line to: shell = 'cmd.exe' fixed the problem for me. Perhaps this should be configurable.

Now the terminal works, but I don't have the Settings button in Atom packages page for atom-term3. I think it should be there and I don't know why it doesn't show. No errors are printed in the console. The Disable button is not working as well. Also, one quirk is that the terminal prints some 'Not enough storage is available to complete this operation' nonsense.

I hope this will be helpful, maybe at least some of these changes will be incorporated into the code.

ggreer commented 8 years ago

Whoops. Didn't mean to close this. That was GitHub auto-closing because of a description in the PR.

ggreer commented 8 years ago

OK, I've implemented fixes similar to the ones you described and tested the latest version (0.21.4) on Windows. I've also fixed the path to PowerShell, so it works out of the box. If you want a different default shell, you can configure it in term3's settings using the option called "shell override".

Thanks so much for the step-by-step instructions on what to fix. It was very helpful.

welcomdyp commented 6 years ago

wher is the package.json?