withfig / fig

Public issue tracker for Fig.
https://fig.io
MIT License
2.06k stars 63 forks source link

bug: Running new scripts with input #2138

Open fabianhijlkema opened 1 year ago

fabianhijlkema commented 1 year ago

Checks

Operating system

MacOS 12.6.1

Expected behaviour

Fig scripts to work with input.

Actual behaviour

Running script results in command not found.

$ fig run kill-all-processes-at-port
$ 00~fig run kill-all-processes-at-port --port 300201~
bash: 00~fig: command not found

After running exec zsh it does seem to work.

$ exec zsh
 ~ % fig run kill-all-processes-at-port
 ~ % fig run kill-all-processes-at-port --port 3002
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]

Steps to reproduce

Adding Kill all processes at port script from scripts store. Running the script.

Environment

fig-details:
  - 2.9.0
hardware-info:
  - model: 
  - model-id: 
  - chip-id: Apple M1
  - cores: 8
  - mem: 16.00 GB
os-info:
  - macOS 12.6.1 (21G217)
environment:
  - shell: /bin/bash
  - terminal: terminal
  - cwd: /Users/fabianhijlkema
  - exe-path: /Users/fabianhijlkema/.fig/bin/fig
  - install-method: unknown
  - env-vars:
    - FIG_PID: 22130
    - TERM: xterm-256color
    - SHELL: /bin/bash
    - FIGTERM_SESSION_ID: 37081b81-92c6-444e-9ffe-c63d313a0bdf
    - FIG_SET_PARENT_CHECK: 1
    - PATH: /Library/Frameworks/Python.framework/Versions/3.10/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Users/fabianhijlkema/.rbenv/shims:/Users/fabianhijlkema/.rbenv/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Users/fabianhijlkema/.nvm/versions/node/v16.18.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/local/git/bin:/Users/fabianhijlkema/.fig/bin:/Users/fabianhijlkema/.local/bin
    - FIG_HOSTNAME: Fabians-MBP.home
    - __CFBundleIdentifier: com.apple.Terminal
    - DISPLAY: /private/tmp/com.apple.launchd.ZBLH7fdu3e/org.macosforge.xquartz:0
    - FIG_TERM: 2.9.0
mschrage commented 1 year ago

Fig uses "bracketed paste" to insert text into the shell on your behalf. It looks like your terminal or some shell plugin is preventing this in bash. Can you share your bashrc?

Also in the meantime, you can change this setting to have the script run directly:

fig settings scripts.insert-into-shell false
fabianhijlkema commented 1 year ago

.bashrc file

# Fig pre block. Keep at the top of this file.
[[ -f "$HOME/.fig/shell/bashrc.pre.bash" ]] && builtin source "$HOME/.fig/shell/bashrc.pre.bash"
###-tns-completion-start-###
if [ -f /Users/fabianhijlkema/.tnsrc ]; then
    source /Users/fabianhijlkema/.tnsrc
fi
###-tns-completion-end-###
export PATH=$HOME/bin:$PATH

export PATH="/Users/fabianhijlkema/.deta/bin:$PATH"

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

export PATH="/Users/fabianhijlkema/.deta/bin:$PATH"

# Fig post block. Keep at the bottom of this file.
[[ -f "$HOME/.fig/shell/bashrc.post.bash" ]] && builtin source "$HOME/.fig/shell/bashrc.post.bash"

With the proposed setting it also works.