Closed MassMessage closed 2 years ago
As far i know(let me know if you have a better solution) to start powershell in a directory you have to do something like this:
powershell.exe -NoExit -command "& {Set-Location C:\my\path\here}"
Now I'm trying to reproduce this with spawn from node-pty like this:
spawn
node-pty
const shell = isWindows ? 'powershell.exe' : 'bash'; const args = !isNullOrEmptyOrWhiteSpaced(shellStartFolder) ? ["-command", `"& {Set-Location ${shellStartFolder}}"`] : []; return spawn(shell, args, { name: 'xterm-color', cols: DefaultTerminalSize.cols, rows: DefaultTerminalSize.rows, cwd: isWindows ? process.env.USERPROFILE : process.env.HOME, env: process.env as INonUndefinedEnv });
but pseudo terminal (i'm using xterm.js) end up like this (give shellStartFolder is "C:\\")
shellStartFolder
"C:\\"
What am I missing?
Well, I just passed it it as cwd argument lol. Didn't come my mind before
cwd
Environment details
Issue description
As far i know(let me know if you have a better solution) to start powershell in a directory you have to do something like this:
powershell.exe -NoExit -command "& {Set-Location C:\my\path\here}"
Now I'm trying to reproduce this with
spawn
fromnode-pty
like this:but pseudo terminal (i'm using xterm.js) end up like this (give
shellStartFolder
is"C:\\"
)What am I missing?