Skip to content

Ignored shell name in language identifier #999

@stessaris

Description

@stessaris

Shell name in language identifier doesn't seem to be used in most of the cases, reverting to default shell. I observed it in vscode (vscode 1.107.1 and vscode-runme 3.16.0) and command line. The odd thing is that within vscode terminal, the cli version works as expected (see below); so it must be something related with the environment. Any suggestion for further tests?

Using the following markdown file for testing the shell:

```sh { name="Sh" }
echo "Using:" `ps -o comm='' -p $$`
```

```bash { name="Bash" }
echo "Using:" `ps -o comm='' -p $$`
```

```zsh { name="Zsh" }
echo "Using:" `ps -o comm='' -p $$`
```

```ksh { name="Ksh" }
echo "Using:" `ps -o comm='' -p $$`
```

CLI in terminal

Default shell

❯2❯ printenv SHELL
/bin/zsh

❯2❯ runme run --all --allow-unnamed --skip-prompts --filename=which_shell.md
 ►  Running task "Sh"...
Using: /bin/zsh
 ►  ✓ Task "Sh" exited with code 0
 ►  Running task "Bash"...
Using: /bin/zsh
 ►  ✓ Task "Bash" exited with code 0
 ►  Running task "Zsh"...
Using: /bin/zsh
 ►  ✓ Task "Zsh" exited with code 0
 ►  Running task "Ksh"...
Using: /bin/ksh

 ►  ✓ Task "Ksh" exited with code 0

Changing the SHELL env variable:

❯2❯ SHELL=/bin/bash runme run --all --allow-unnamed --skip-prompts --filename=which_shell.md
 ►  Running task "Sh"...
Using: /bin/bash
 ►  ✓ Task "Sh" exited with code 0
 ►  Running task "Bash"...
Using: /bin/bash
 ►  ✓ Task "Bash" exited with code 0
 ►  Running task "Zsh"...
Using: /bin/bash
 ►  ✓ Task "Zsh" exited with code 0
 ►  Running task "Ksh"...
Using: /bin/ksh

 ►  ✓ Task "Ksh" exited with code 0

vscode

With the Run Block button:

Image

In "notebook" mode:

Image

CLI in vscode terminal

Oddly enough, within the vscode terminal it works as expected:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions