microsoft / node-pty

Fork pseudoterminals in Node.JS
Other
1.47k stars 240 forks source link

[Question] Specify winpty.exe via Environment Variable #692

Closed hcoona closed 2 days ago

hcoona commented 3 months ago

Environment details

Issue description

Is it possible to specify winpty.exe full path via Environment Variable? I installed it in MSYS2 but I don't what to expose all bins to my PATH.

Tyriar commented 3 months ago

Why are you asking? winpty should be is shipped with node-pty and it gets imported relatively here:

https://github.com/microsoft/node-pty/blob/efbf8ebbe7b09351548fa0a4ed07b36c5d2e539b/src/windowsPtyAgent.ts#L77-L89

hcoona commented 3 months ago

I installed is with pnpm and it cannot find winpty automatically.

E:\pnpm-global\5\.pnpm\@homebridge+node-pty-prebuilt-multiarch@0.11.14\node_modules\@homebridge\node-pty-prebuilt-multiarch\lib\windowsPtyAgent.js:79
            term = this._ptyNative.startProcess(file, cols, rows, debug, this._generatePipeName(), conptyInheritCursor);
                                   ^

Error: File not found:
    at new WindowsPtyAgent (E:\pnpm-global\5\.pnpm\@homebridge+node-pty-prebuilt-multiarch@0.11.14\node_modules\@homebridge\node-pty-prebuilt-multiarch\lib\windowsPtyAgent.js:79:36)
    at new WindowsTerminal (E:\pnpm-global\5\.pnpm\@homebridge+node-pty-prebuilt-multiarch@0.11.14\node_modules\@homebridge\node-pty-prebuilt-multiarch\lib\windowsTerminal.js:53:24)
    at Object.spawn (E:\pnpm-global\5\.pnpm\@homebridge+node-pty-prebuilt-multiarch@0.11.14\node_modules\@homebridge\node-pty-prebuilt-multiarch\lib\index.js:30:12)
    at new ISTerm (file:///E:/pnpm-global/5/.pnpm/@microsoft+inshellisense@0.0.1-rc.15/node_modules/@microsoft/inshellisense/build/isterm/pty.js:36:25)
    at Object.spawn (file:///E:/pnpm-global/5/.pnpm/@microsoft+inshellisense@0.0.1-rc.15/node_modules/@microsoft/inshellisense/build/isterm/pty.js:279:12)
    at async render (file:///E:/pnpm-global/5/.pnpm/@microsoft+inshellisense@0.0.1-rc.15/node_modules/@microsoft/inshellisense/build/ui/ui-root.js:16:18)
    at async Command.<anonymous> (file:///E:/pnpm-global/5/.pnpm/@microsoft+inshellisense@0.0.1-rc.15/node_modules/@microsoft/inshellisense/build/commands/root.js:35:5)

Node.js v20.15.0

After I download winpty by myself and added it to PATH, is can run.

And I cannot find winpty.exe anywhere.

Tyriar commented 2 days ago

winpty is definitely compiled after yarn is run (or npm i after https://github.com/microsoft/node-pty/pull/721). Maybe this is an issue with pnpm?