lukesampson / psutils

Command line utilities written in Powershell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't work when the username has space in it

fr2edms2ekr opened this issue · comments

Just to be clear, it works fine so far using windows powershell, but it fails when switching to git bash (which is what i use almost always), and shows this error:
** Presuming my windows username is Lina Lina**

C:\Users\Lina : The term 'C:\Users\Lina' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • C:\Users\Lina Lina\scoop\apps\sudo\current\sudo.ps1
  •   + CategoryInfo          : ObjectNotFound: (C:\Users\Lina:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    

To fix this, the path to sudo must be escaped. Example of a broken shim:

> cat 'C:\Users\Felipe Santos\scoop\shims\sudo'
#!/bin/sh
powershell.exe -noprofile -ex unrestricted "C:\Users\Felipe Santos\scoop\apps\sudo\current\sudo.ps1"  "$@"

Example of a working shim:

> cat 'C:\Users\Felipe Santos\scoop\shims\sudo'
#!/bin/sh
powershell.exe -noprofile -ex unrestricted "C:\Users\Felipe` Santos\scoop\apps\sudo\current\sudo.ps1"  "$@"

Notice the ` before the space.