intellij-powershell
intellij-powershell copied to clipboard
When windows username has a space, powershell terminal fails to initialize
trafficstars
When the windows user folder contains a space, the powershell terminal fails to initialize. Example Username: Fooby Doobar
C:\Users\Fooby : The term 'C:\Users\Fooby' 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\Fooby Doobar\AppData\Local\Temp\start-pses-host ...
+ ~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\Users\Fooby:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Reproduced even without changing my user name using the following patch:
Index: src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/languagehost/EditorServicesLanguageHostStarter.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/languagehost/EditorServicesLanguageHostStarter.kt b/src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/languagehost/EditorServicesLanguageHostStarter.kt
--- a/src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/languagehost/EditorServicesLanguageHostStarter.kt (revision Staged)
+++ b/src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/languagehost/EditorServicesLanguageHostStarter.kt (date 1694812411864)
@@ -39,7 +39,7 @@
open class EditorServicesLanguageHostStarter(protected val myProject: Project) : LanguageHostConnectionManager {
- private val LOG: Logger = Logger.getInstance(javaClass)
+ private val LOG: Logger = Logger.getInstance(javaClass)
private var socket: Socket? = null
private var myReadPipe: RandomAccessFile? = null
private var myWritePipe: RandomAccessFile? = null
@@ -208,7 +208,7 @@
"-LogLevel '$logLevel' -LogPath '$logPath' -SessionDetailsPath '$sessionDetailsPath' -FeatureFlags @() $splitInOutPipesSwitch"
val scriptText = "${escapePath(startupScript)} $args\n"
- val scriptFile = File.createTempFile("start-pses-host", ".ps1")
+ val scriptFile = File.createTempFile("start pses host", ".ps1")
scriptFile.deleteOnExit()
try {
FileUtil.writeToFile(scriptFile, scriptText)
@@ -415,4 +415,4 @@
override fun isConnected(): Boolean = myProcess?.isAlive == true
protected open fun getLogFileName(): String = "EditorServices-IJ-${getSessionCount()}"
private fun createLogPath(psExtensionPath: String): String = FileUtil.toCanonicalPath("$psExtensionPath/sessions/${getLogFileName()}.log")
-}
\ No newline at end of file
+}
While I am planning to fix the issue, I'd recommend using the ordinary IDE terminal instead of this console.