node-pty icon indicating copy to clipboard operation
node-pty copied to clipboard

[Question] Specify winpty.exe via Environment Variable

Open hcoona opened this issue 1 year ago • 2 comments

Environment details

  • OS: Windows 11
  • OS version:
  • node-pty version:

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.

hcoona avatar Jul 04 '24 01:07 hcoona

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

Tyriar avatar Jul 05 '24 13:07 Tyriar

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

E:\pnpm-global\5\.pnpm\@[email protected]\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\@[email protected]\node_modules\@homebridge\node-pty-prebuilt-multiarch\lib\windowsPtyAgent.js:79:36)
    at new WindowsTerminal (E:\pnpm-global\5\.pnpm\@[email protected]\node_modules\@homebridge\node-pty-prebuilt-multiarch\lib\windowsTerminal.js:53:24)
    at Object.spawn (E:\pnpm-global\5\.pnpm\@[email protected]\node_modules\@homebridge\node-pty-prebuilt-multiarch\lib\index.js:30:12)
    at new ISTerm (file:///E:/pnpm-global/5/.pnpm/@[email protected]/node_modules/@microsoft/inshellisense/build/isterm/pty.js:36:25)
    at Object.spawn (file:///E:/pnpm-global/5/.pnpm/@[email protected]/node_modules/@microsoft/inshellisense/build/isterm/pty.js:279:12)
    at async render (file:///E:/pnpm-global/5/.pnpm/@[email protected]/node_modules/@microsoft/inshellisense/build/ui/ui-root.js:16:18)
    at async Command.<anonymous> (file:///E:/pnpm-global/5/.pnpm/@[email protected]/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.

hcoona avatar Jul 08 '24 03:07 hcoona

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?

Tyriar avatar Oct 03 '24 13:10 Tyriar