Open Zibri opened 3 years ago
if (typeof process.env.ComSpec == "undefined") { cmd = "bash"; cmdargs = ["-i"] } else { cmd = "cmd.exe"; cmdargs = [] } mypty = pty.spawn( cmd, cmdargs, { name: 'xterm-256color', cols: 80, rows: 25, env: process.env, encoding: null });
if cmd and cmdargs is bash -i, with encoding:null mypty.on("data") returns a Buffer as it should. but if running on windows and cmd and cmdargs are CMD.EXE then mypty.on("data") returns a STRING!
Right now we have this as a warning:
https://github.com/microsoft/node-pty/blob/3794fb111c51f2fa03ee6150468cc462db76699a/src/windowsTerminal.ts#L33-L35
Though it won't show up if you pass in null, we should fix that and also update the .d.ts to explain.
null
if cmd and cmdargs is bash -i, with encoding:null mypty.on("data") returns a Buffer as it should. but if running on windows and cmd and cmdargs are CMD.EXE then mypty.on("data") returns a STRING!