How to execute more than one commands in one ShellTerminalWidget?

Answered

Hello.

val terminalView = TerminalView.getWidgetByContent(selectedContent) as ShellTerminalWidget
terminalView.executeCommand("some command")

This code work ok.

When I`m trying to call the same code again, exception occurs:

Cannot execute command when another command is typed: D:\_sources\IDEA\tests\Git Helper Test>

But not every time. Sometimes executes but mostly throws exception.

"D:\_sources\IDEA\tests\Git Helper Test>" is not command - this is terminal path

What I`m doing wrong?

0
4 comments

Artem,

This may happen when the previous command wasn't finished yet. You can check that with:

val connector = ShellTerminalWidget.getProcessTtyConnector(terminalView.ttyConnector);
TerminalUtil.hasRunningCommands(connector)
0

I always check running commands by terminalView.hasRunningCommands(). This is not the reason

0

Can I ask you to file an issue in YouTrack?

0

Please sign in to leave a comment.