Skip to content

Git bash failed to execute Run/debug when Window username have blank space #678

Closed

Description

@vtvh
Environment
  • Operating System: Window 7
  • JDK version: AdoptOpenJDK 8.0.222.10
  • Visual Studio Code version: 1.38.1
  • Java extension version: 0.49.0
Steps To Reproduce
  1. Use git bash as defaut integrated shell
  2. Execute run or debug via hover menu.
Current Result
$ "C:\\Users\\Andree Hai\\.vscode\\extensions\\vscjava.vscode-java-debug-0.22.0\\scripts\\launcher.bat" "C:\\Program Files\\AdoptOpenJDK\\jdk-8
.0.222.10-hotspot\\\\bin\\java" -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:65414 -Dfile.encoding=UTF-8 -cp "C:\\Us
ers\\Andree Hai\\_workspace\\introjava\\assign4\\bin" app.App2
'C:\Users\Andree' is not recognized as an internal or external command,
operable program or batch file.

Activity

  1. testforstephen commented on Sep 29, 2019

    @testforstephen
    Contributor

    The error style looks like running in cmd.
    The bash error is like bash: C:\Users\jinbwan : No such file or directory

    Could you kill all existing terminals and try again?

  2. vtvh commented on Sep 29, 2019

    @vtvh
    Author

    My default shell is Git Bash
    "terminal.integrated.shell.windows": "C:\Program Files\Git\bin\bash.exe",
    image

  3. testforstephen commented on Sep 30, 2019

    @testforstephen
    Contributor

    Using double quote to escape spaces works for my git bash environment.
    image

    Here is my git environment. Not sure what's difference with yours.

    Git Version:

    $ git --version --build-options
    git version 2.23.0.windows.1
    cpu: x86_64
    built from commit: 4db2e5cc9e1522131a039cbad3970f147a39f0ce
    sizeof-long: 4
    sizeof-size_t: 8
    

    Git installation options:

    
    
    # One of the following:
    > type "C:\Program Files\Git\etc\install-options.txt"
    > type "C:\Program Files (x86)\Git\etc\install-options.txt"
    > type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
    
    $ cat /etc/install-options.txt
    Editor Option: VisualStudioCode
    Custom Editor Path:
    Path Option: CmdTools
    SSH Option: OpenSSH
    Tortoise Option: false
    CURL Option: OpenSSL
    CRLF Option: CRLFCommitAsIs
    Bash Terminal Option: MinTTY
    Performance Tweaks FSCache: Enabled     
    Use Credential Manager: Enabled
    Enable Symlinks: Disabled
    Enable Builtin Interactive Add: Disabled
    

    Git Bash:

    $ bash -help
    GNU bash, version 4.4.23(1)-release-(x86_64-pc-msys)
    Usage:  bash [GNU long option] [option] ...
            bash [GNU long option] [option] script-file ...
    

    Also found a similar issue in git repository git-for-windows/git#2219 .

  4. m1ndwalker commented on Nov 1, 2019

    @m1ndwalker

    I'm having exactly the same issue!

    It seems to be related with the launcher.bat command. For testing purposes, if I remove the launcher.bat out of the equation and paste the contents of the temp arg file, then I get something along the lines of

    "C:\\Users\Joel Alvim\DevelopmentTools\Java\JDK11\bin\java" -Dfile.encoding=UTF-8 -classpath "C:\\Users\\Joel Alvim\\Documents\\MyData\\Projects\\CSVtoJSON\\target\\classes;C:\\Users\\Joel Alvim\\.m2\\repository\\com\\fasterxml\\jackson\\core\\jackson-core\\2.9.8\ \jackson-core-2.9.8.jar;C:\\Users\\Joel Alvim\\.m2\\repository\\com\\fasterxml\\jackson\\core\\jackson-databind\\2.9.8\\jackson-databind-2.9.8.jar;C:\\Users\\Joel Alvim\\.m2\\repository\\com\\fasterxml\\jackson\\core\\jackson-annotations\\2.9.0\\jackson-annotations- 2.9.0.jar" some.App

    This above works in the integrated terminal

    The original below doesn't
    "C:\\Users\\Joel Alvim\\.vscode\\extensions\\vscjava.vscode-java-debug-0.23.0\\scripts\\launcher.bat" "C:\\Users\\Joel Alvim\\DevelopmentTools\\Java\\JDK11\\bin\\java" -Dfile.encoding=UTF-8 @C:\\Users\\JOELAL~1\\AppData\\Local\\Temp\\cp_9i03mo6zpdpj3xoi5eid3h5gr.a rgfile some.App

  5. testforstephen commented on Nov 6, 2019

    @testforstephen
    Contributor

    Could you have a try to change the terminal to powershell or cmd?

  6. m1ndwalker commented on Nov 7, 2019

    @m1ndwalker

    Could you have a try to change the terminal to powershell or cmd?

    For me that works, but the whole point was to use the power of 'nix

  7. vtvh commented on Nov 26, 2019

    @vtvh
    Author

    It seems this problem cannot be solved without change %USERPROFILE% folder to one without spaces. I've switched to portable VSCode instead, which is more convinient and easily to move the editor around.
    https://code.visualstudio.com/docs/editor/portable

  8. edu-eng commented on Jan 27, 2020

    @edu-eng

    @andreehai1011 Take the test by switching to PowerShell

  9. testforstephen commented on Jan 20, 2021

    @testforstephen
    Contributor

    It seems to be related with the launcher.bat command. For testing purposes, if I remove the launcher.bat out of the equation and paste the contents of the temp arg file, then I get something along the lines of

    "C:\Users\Joel Alvim\DevelopmentTools\Java\JDK11\bin\java" -Dfile.encoding=UTF-8 -classpath "C:\Users\Joel Alvim\Documents\MyData\Projects\CSVtoJSON\target\classes;C:\Users\Joel Alvim\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.9.8\ \jackson-core-2.9.8.jar;C:\Users\Joel Alvim\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.9.8\jackson-databind-2.9.8.jar;C:\Users\Joel Alvim\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations- 2.9.0.jar" some.App

    This above works in the integrated terminal

    m1ndwalker You're right. I also can reproduce this in git bash. If the first argument after the bat contains space (e.g. "x y"), the bat file failed because of unexpected path.
    image

    This is a Git bash issue. To unblock the debugger users who're using Git bash, i would disable the launcher.bat if the windows user name has blank spaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions