Which shell should be used for Bazel under Windows 10 - powershell

Usually, on Windows, I use PowerShell (default shell) to call a Bazel command such as bazel build. As far as I understand Bazel makes use of MSYS2 to call and execute commands such as curl, zip or git for instance. Therefore, I wonder if I should use the MSYS2 bash terminal instead of PowerShell. Can there be any problems when using Powershell instead of the MSYS2 bash terminal? Or doesn’t it matter?

As its mentioned here by developers of bazel, using MSYS or MSYS2 is the best choice. Personally I prefer MSYS* over cmd or PowerShell for any thing.

In the current master there was recently an update of the documentation exactly about this issue:
As of 2020-01-15, we do not recommend running Bazel from bash – either
from MSYS2 shell, or Git Bash, or Cygwin, or any other Bash variant.
While Bazel may work for most use cases, some things are broken, like
interrupting the build with Ctrl+C from MSYS2). Also, if you choose to
run under MSYS2, you need to disable MSYS2’s automatic path
conversion, otherwise MSYS will convert command line arguments that
look like Unix paths (e.g. //foo:bar) into Windows paths. See this
StackOverflow answer for details.

Related

How to get Emacs on MINGW64 (Windows 10)

I currently use MINGW64 (Git Bash) as my terminal on my Windows 10 machine. It works great, I like it, but it only has Vim installed as an editor and I prefer Emacs. I'm unfortunately having a really awful time getting it to work in my terminal.
What's weirder still is that I have Emacs working in Cygwin64; but I don't like using that as my terminal. The most logical fix is simply that it Emacs to my Path ENV, however that doesn't seem to help (perhaps I'm doing that wrong?). I just get bash: emacs: command not found. I found a command to install it, using Pacman, however the Pacman command cannot be found either (which is weird because I thought that was installed by default with MINGW64.
Would love any and all help on this.
A couple of options:
Use Cygwin and the Cygwin emacs. Consider your Cygwin environment completely separate from Windows, so set your PATH from within the .bashrc, not within Windows. Launch emacs from the bash command-line.
Use the Emacs Windows binary distribution, but point to the utilities within Cygwin (there's an emacs package to help with this). Again, launch from the bash command line to inherit the bash environment within emacs.
Use the Windows Subsystem for Linux, with a Linux installation, and stick with emacs from there. You get the best of the Linux world, and access to the Windows directories and files as well.
My goto choice for MANY years was the Emacs Windows binary in conjunction with Cygwin. Once I started using the WSL, however, it just worked a lot better, in a clean Linux environment, and I could get terminal and GUI emacs (and other apps) running using the VcXsrv X Server. WSL has a version that directly supports X Windows, but I don't care for the windowing environment it uses, so I stick with VcXsrv.

sudo command is not working in Vscode terminal

I am using vscode in Linux Mint.
"sudo, root, npm" commands are not working in Vscode bash terminal. I can only use cd, ls and install commands.
yearmfew#mySpace:~/jules/clr-6$ npm
bash: npm: command not found
It was because of flatpak. I have vscode from there installed. It is officially distributed in snap. I have downloaded from there and it is okay now.
This is explained in the documentation for VS Code : https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration
(which has various options), but to avoid this being a link-only answer:
Set the "terminal.integrated.shell.windows" VS Code configuration variable to "C:\Windows\System32\bash.exe" and you should be good to go.
For convenience, there's also a Select Default Shell command in the command palette which sets this for you.

Chmod u+x windows cmd

I'm trying to install Scalatra on windows seven and need to change a file to executable...the Scalatra documentation says to do this, which is unix. What is the windows equivalant?
chmod u+x srt
You can simply open the relevant folder with a unix command prompt (I use git bash) and execute the unix commands from there
To get scalatra-sbt going on Windows, either port you own sbt.bat from scalatra-sbt, or install chmod via cygwin.
Assuming you've successfully installed the rest of Conscript and giter8, you can start a project that downloads scalatra-sbt. From there, one can look through the ./sbt source, and port the bash script functionality to your own windows specific script, or install a unix compatibility layer into Windows. If you go down the "windows specific script" route, perhaps the scalatra-sbt would appreciate the project contribution.
The "unix compatibility layer" route will eventually allow you to run ./sbt. chmod is a unix command line function, and is provided in a default package of the tool set cygwin, which provides a complete lunix-like environment. Once inside a cygwin terminal, you can chmod your file, as mentioned in the scalatra-sbt first project.
Diving into the contents of ./sbt from scalatra-sbt, this is actually unix script wrapper around the scala build tool (also referred to, confusingly, as sbt). If while trying to run ./sbt you get strange '\r' errors, install the cygwin package dos2unix, and then run it on the sbt file. If you run into any "which: no curl in..." or "which: no wget in..." errors, go back to the cygwin installer, find those packages such as wget, and then install those programs.
By the way, the last thing the scalatra-sbt script runs is the Scala build tool. The Scala build tool sbt itself has many reported issues with cygwin's default configuration, so you will likely need to do more research. Depending on what issues you're running into on your specific setup, you may need to make changes to the end of the ./sbt script to adjust the parameters used to launch the Scala build tool.

Is it possible to run emacs under MSYS?

I'm using MSYS with mintty
is it possible to run emacs with it? This emacs should accept posix path's, etc.
I want to use path's like: /c/Ptogram\ Files/
Which build I should use?
Sure. Just run the standard Emacs build for Windows, and make sure it is in your $PATH.

How do I get eshell working correctly in emacs?

For some reason, when I type in commands I'm used to on linux, it works perfectly, as it does in bash... But in eshell, it doesn't work.
I've narrowed the problem to a trivial and small sample, as follows:
$ du
c:/Program: command not found
$ which bash
c:/Program Files (x86)/Git/bin/bash.exe
How do I get this working? (du is whatever it is by default... It's implemented in elisp, I haven't made any unusual changes there, that is, it's a compiled lisp function in `em-unix.el')
I would've expected something along the lines of "You have used 1.3 GiB of disk space", rather than that command not found error.
It doesn't use bash.exe, but it can use du.exe, when present.
On my system:
c: gutov $ which bash.exe
which: no bash.exe in ...
c: gutov $ which du.exe
h:/Apps/System/gnuwin32/bin/du.exe
From your error message I can tell that it calls some command and fails because it doesn't properly quote the path to executable (which contains spaces). Maybe you should do M-x report-emacs-bug.
Overall, I recommend:
1) Uninstall Git and reinstall it selecting the second option when asked about your PATH environment ("Run Git from the Windows Command Prompt"). This will remove the unix tools packaged with it from PATH.
2) Install in some directory without spaces and add to PATH unix tools from GnuWin32 project, or from Eli Zaretski's ports. The latter contains fewer packages overall, but it has a much faster find, for example. You can mix them.
Alternatively, maybe you can get away with just reinstalling Git into directory without spaces.