Skip to content

[Bug] File paths with spaces cause incorrect command execution on Linux #147

@aditya-an1l

Description

@aditya-an1l

Recently, while running the application, there has been a persistent issue where the runner fails to run properly whenever there is a white-space in the path name.

When a file is located in a directory whose path contains spaces (e.g. ~/Documents/ABC COMPANY/), the runner splits the path at the space and passes only the first segment to the interpreter.

This thus results in a "file not found" error even though the file exists.

Note: More generalised issue of #146 , spanning over to other languages as well

Steps to Reproduce

I am taking Python code for this demonstration.

  1. Create a file in a directory whose path contains a space:

    ~/Documents/ABC COMPANY/hello.py
    
  2. Open the file in Neovim and run the code runner (e.g. :RunCode).

  3. Observe the terminal output:

    python: can't open file '/home/user/Documents/ABC': [Errno 2] No such file or directory
    

Expected Behaviour

The full path should be passed to the interpreter as a single argument:

python3 /home/user/Documents/ABC COMPANY/hello.py

Actual Behaviour

The path is getting split at the whitespace. Only the segment up to the first space is passed:

python3 /home/user/Documents/ABC

The classic faulty white-space parsing

Environment Info

Field Value
OS Linux (Arch Linux, tested; likely all distros)
Neovim version 0.10+
Plugin version latest main

Although I feel that this bug will show up in other Linux and MacOS environments as well

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions