Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running 'Jaguar: Flash' action while having an open 'Jaguar: Monitor' terminal misbehaves #187

Open
kasperl opened this issue Jan 5, 2022 · 4 comments
Assignees

Comments

@kasperl
Copy link
Contributor

kasperl commented Jan 5, 2022

Looks like we just try to issue the command 'jag flash ...' in the same terminal without stopping the running program. I would expect this to run in another terminal and fail instead.

@lask
Copy link
Contributor

lask commented Jan 6, 2022

It is exactly what we do. You can only have one thing running on each port at a time which is why we reuse the terminal. If we run it in a new terminal, then you can end up with many terminals and will have to manually close all the terminals. I am not convinced that is better.

@lask
Copy link
Contributor

lask commented Jan 6, 2022

We can send a Ctrl-C to make sure that everything is actually sent. Would that be better?

@kasperl
Copy link
Contributor Author

kasperl commented Jan 6, 2022

Do we know that we're reusing the terminal (if it is already running)? If so, we could also just abandon the operation because it is not going to work and tell the user.

@lask
Copy link
Contributor

lask commented Jan 6, 2022

We could know whether the terminal is already running (right now we don't), but we do not know whether the previous command has exited. I think there are two way to do this but neither is optimal.

Using VS Code output
We could use an output instead of a terminal. In this case, we would use the node child_process lib to execute the commands and just forward the output to the appropriate output window.

The advantage would be that we can use the child process to keep track of the state of the command. In other words, we could know whether the previous command is still running.

The disadvantage here is that there is no good way to cancel a running command. We cannot extend the output view with buttons for interrupting the child process which I assume is to prevent extension developers to use outputs for other things than output. This issue extends to commands that require user interaction where we have no way of doing the interaction (we try to not use commands that require user interaction, but we have had changes to the CTL that would have been breaking for the VS Code extension if we were using output). If a command that uses a port doesn't terminate, then we have blocked that port (until it is reconnected) which is not great.

Using VS Code terminal
This is what we use. We open a terminal and send commands to it.

The advantage is that it is simple and a user can always interact with the terminal. The disadvantage is that it is simple, so we cannot know whether commands are running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants