Skip to content

Shell Not Changing in Zed Editor Task #30816

Closed
@enamulhasanabid

Description

@enamulhasanabid

Summary

Description:
I am encountering an issue in the Zed editor where the shell does not change to the specified shell in the tasks.json file. Despite specifying the shell command, the editor continues to use the system shell when running tasks.

Steps to Reproduce:

  1. Open Zed editor.
  2. In the tasks.json file, I specified the shell command as follows:
    [
        {
            "label": "Compile & Run",
            "command": "/usr/bin/bash ~/.config/zed/compilebuildrun.sh",
            "description": "compiles & runs the current code file",
            "use_new_terminal": false,
            "allow_concurrent_runs": false,
            "reveal": "always",
            "show_summary": false,
            "show_output": false
        }
    ]
  3. Save the tasks.json file.
  4. Run the task.

Expected Behavior:
The task should execute using the specified shell (/usr/bin/bash) and run the script located at ~/.config/zed/compilebuildrun.sh.

Actual Behavior:
The task runs using the system shell (/usr/bin/zsh), as shown below:

⏵ Command: /usr/bin/zsh -i -c 'sh ~/.config/zed/compilebuildrun.sh'

Contents of compilebuildrun.sh:

#!/bin/bash

# Access the full path using ZED_FILE
full_path="$ZED_FILE"

# Extract filename with extension
filename_ext=$(basename "$full_path")

# Extract filename and extension
filename="${filename_ext%.*}"
extension="${filename_ext##*.}"

echo "[running $filename_ext]"
echo ""

if [[ "$extension" == "cpp" ]]; then
    g++ "$full_path" -o "$filename" && ./"$filename";

elif [[ "$extension" == "c" ]]; then
    gcc "$full_path" -o "$filename" && ./"$filename";

elif [[ "$extension" == "py" ]]; then
    python3 "$full_path";

else
    echo "no"
fi

Environment:

  • Shell specified: /usr/bin/bash

Additional Information:

  • I have verified that the path to the script is correct and that the script is executable.

Zed Version and System Specs

Zed: v0.186.7 (Zed)
OS: Linux Wayland Arch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions