Nushell: The Azure CLI AZ command isn't shelling out

Created on 18 Dec 2019  ยท  5Comments  ยท  Source: nushell/nushell

With AZCLI installed on Windows 10, try to call az.

[ 15:09:38 ] โฏ az
error: Command not found
- shell:1:0
1 | az
  | ^^ command not found

In PowerShell and CMD the command works fine and other binaries are working as expected.

โฏ get-command az

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     az.cmd                                             0.0.0.0    C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd

Nu Shell version 0.6.1.

Most helpful comment

@cdhunt - Ultimately, it will likely be supported, but it's not there yet. We'll need to add support to detect the type of thing it is (do we need to invoke powershell? cmd? bash? etc) before we can run it - and this detection would also work crossplatform.

We used to have shelling to a default on by default, but this causes some annoying corner cases at the system level where aborting processes would also take Nu down with them. We're working on ways to avoid this, if possible.

All 5 comments

@cdhunt - I had this surprise too. You'll notice that az points to az.cmd which is a script file (rather than an .exe). We don't yet support automatically calling the correct system to run the script, so you'll need to do it by hand.

You can do:

> cmd /c \path\to\az.cmd

For me, that's:

> cmd /c "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.CMD"

The docs say if the command isn't recognized, it will shell out. Why would a cmd or bat file be treated differently? AZCLI is a fantastic use case for Nu and az is a lot more friendly than cmd /c "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.CMD"

@cdhunt - Ultimately, it will likely be supported, but it's not there yet. We'll need to add support to detect the type of thing it is (do we need to invoke powershell? cmd? bash? etc) before we can run it - and this detection would also work crossplatform.

We used to have shelling to a default on by default, but this causes some annoying corner cases at the system level where aborting processes would also take Nu down with them. We're working on ways to avoid this, if possible.

This is related to, and possibly a dup of, https://github.com/nushell/nushell/issues/992

Closing as duplicate.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alper picture alper  ยท  4Comments

coolshaurya picture coolshaurya  ยท  4Comments

senden9 picture senden9  ยท  3Comments

ne-on picture ne-on  ยท  5Comments

llimllib picture llimllib  ยท  5Comments