CaptainUnbrauchbar / asp-language-support

MIT License
7 stars 2 forks source link

Issue with running clingo with spaces in path name of extension #14

Open matthiasknorr opened 11 months ago

matthiasknorr commented 11 months ago

Could you please check if it is possible to fix an issue (observed under Windows by a student during the classes), where the space in the user name caused an error when trying to run clingo. The suggested solution would be to convert the path to the clingo executable to a String to avoid the problem.

richilino commented 11 months ago

Thanks for reporting this bug. We're trying to reproduce and fix this issues in the next few days!

vorlon77 commented 7 months ago

The issue here is that at least on Windows path names need to be quoted if they have a space.

The file extension.js has the following code:

function getPath() {
    if (terminalType === "Git Bash") {
        return `"${path}"`
    } 
    else {
        return `${path}`
    }
}

which only adds quotes to the path if the terminalType is Git Bash.

Spaces in a username are a pain. I would suggest just quoting it all of the time for windows, but this likely won't work on PowerShell since you would have to use something like

return `& "${path}"`

where as with cmd as the default shell you'd want

return `"${path}"`

Probably a better solution is similar to what is described on https://github.com/microsoft/vscode/issues/135118 and use a vscode.ShellQuotedString instead of a string for the path except that I'd try using ShellQuoting.Escape for the command because of the PowerShell quoting rules.