Closed mySingleLive closed 1 year ago
If using the new PowerShell (https://aka.ms/pwsh) is acceptable for you this one works for windows:
_pty = Pty.start(
'cmd.exe',
arguments: ['/k', 'pwsh'],
columns: _terminal.viewWidth,
rows: _terminal.viewHeight,
);
Starting with just cmd.exe
and entering pwsh
works also.
If using the new PowerShell (https://aka.ms/pwsh) is acceptable for you this one works for windows:
_pty = Pty.start( 'cmd.exe', arguments: ['/k', 'pwsh'], columns: _terminal.viewWidth, rows: _terminal.viewHeight, );
Starting with just
cmd.exe
and enteringpwsh
works also.
I've tried, but it's still wrong
Does pwsh
command work on a regular terminal?
Also that example project doesn't include environment variables. Try this one instead:
_pty = Pty.start(
'cmd.exe',
arguments: ['/k', 'pwsh'],
environment: {...Platform.environment},
columns: _terminal.viewWidth,
rows: _terminal.viewHeight,
);
Does
pwsh
command work on a regular terminal? Also that example project doesn't include environment variables. Try this one instead:_pty = Pty.start( 'cmd.exe', arguments: ['/k', 'pwsh'], environment: {...Platform.environment}, columns: _terminal.viewWidth, rows: _terminal.viewHeight, );
pwsh
command can work on the external cmd.exe
terminal.
But the Flutter Pty code still can't work (I've added the environment variables).
'pwsh' is not recognized as an internal or external command, operable program or batch file
This error appears in my Flutter Terminal Widget.
Does
pwsh
command work on a regular terminal? Also that example project doesn't include environment variables. Try this one instead:_pty = Pty.start( 'cmd.exe', arguments: ['/k', 'pwsh'], environment: {...Platform.environment}, columns: _terminal.viewWidth, rows: _terminal.viewHeight, );
Oh, it worked!
But I used ['/k', 'powershell']
, instead of ['/k', 'pwsh']
Thank you!
I'm glad that worked!
When I use "powershell.exe" instead of "cmd.exe", an error is reported.
Even if I start with cmd.exe and enter "powershell" in it, the same error is reported
My Code: