runme icon indicating copy to clipboard operation
runme copied to clipboard

`runme open` fails to install code-server when executing in fish shell

Open nikita-vanyasin opened this issue 1 year ago • 6 comments

I have a macos+fish environment. Next command fails (executed in fish shell):

> runme open

No code-server installation found. Do you want to install coder's code-server?

fish: command substitutions not allowed here
__cleanup() {
         ^^
could not execute command: installation command failed: failed to run command: exit code: 127

Next command works fine (also executed in fish shell):

> SHELL=zsh runme open

nikita-vanyasin avatar Aug 06 '24 11:08 nikita-vanyasin

This error indicates that the problem is likely related to the code used to collect environment variables in the session. It's not well-tested across various shells.

Does it happen only for runme open or for runme run <cmd> as well?

adambabik avatar Aug 06 '24 20:08 adambabik

Does it happen only for runme open or for runme run <cmd> as well?

Yes, it is the same error for runme run FILE_LIST for example repo:

> git clone --depth=1 https://github.com/stateful/docs.runme.dev.git
> runme run FILE_LIST
fish: command substitutions not allowed here
__cleanup() {
         ^^
could not execute command: failed to run command "FILE_LIST": exit code: 127

nikita-vanyasin avatar Aug 07 '24 13:08 nikita-vanyasin

Thanks for checking! I think bash, zsh and fish in fairly new versions should work well. We can run tests in a Docker container so we should be able to cover all shells easily. @sourishkrout wdyt?

adambabik avatar Aug 08 '24 18:08 adambabik

Thanks for checking! I think bash, zsh and fish in fairly new versions should work well. We can run tests in a Docker container so we should be able to cover all shells easily. @sourishkrout wdyt?

Sure thing. zsh works for sure. fish used to not but with the latest upgrades might. We are working on a warning notification inside the extension to flag unsupported PowerShell etc right now. Would be great if we could move fish to supported but not a high priority.

sourishkrout avatar Aug 08 '24 19:08 sourishkrout

I've ran into this problem too. I tried setting the interpretor, but I assume this is ignored when running interactively in a shell.

It would be good if this was respected.

\```shell {"id":"01J6HHJDW3A84XPHVHSWC3DC6W","interpreter":"/usr/bin/env bash","name":"deploy"}
sudo nixos-rebuild switch --fast --flake .#(hostname)
\```

rawkode avatar Aug 30 '24 11:08 rawkode

Thanks for the feedback, @rawkode! The way you'd enforce bash is by using frontmatter in the document as per https://docs.runme.dev/Reference/configuration#document-options

So what you'd want to do is use that instead of interpreter, e.g.:

---
shell: bash
---

# Documentation
This is my doc

It's also possible to do this per cell but I'd recommend setting it per document instead.

sourishkrout avatar Sep 03 '24 22:09 sourishkrout