-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Expose output from processes on frontend #5597
Conversation
Can you detail a bit about this? |
Here is an example. We have backend requests that are not a single process. The backend may need to run a number of external processes to carry out a task. We also have a framework that runs these processes and provides overall progress reporting. We can move these requests into My comment was really that the |
I like the idea, but since I am not 100% familiar with the
It is a confusing part, but the terminal reference in |
On looking further at this, it seems to me that the task processes should be using TaskManager, not ProcessManager, to lookup the ids. So task ids are used which we use to lookup the Task. Making this change, it all falls into place. The custom hookup to the client is now done in the Task object, not the Process object, which is much better for a number of reasons. Not only was Process not the place for this, but this also supports Tasks that are not backed by a Process. I do wonder if ProcessManager would not better be TerminalManager, containing only TerminalProcess objects. But that is another discussion. I have updated the PR. Note that all changes are now in |
@marechal-p the ability of the user to kill a running task is indeed something that VS Code has that is missing in Theia. However what is important, IMO, is that it is easy for extenders who are implementing Tasks to add custom requests (such as |
I'm confused, don't we have the |
@vince-fugnitto Yes, you are right. Thanks for pointing that out. I originally implemented this using ProcessManager and I then moved the code from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a build error now, see the CI :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the lengthy review, just want to be sure that we are on the same frequency.
Signed-off-by: Nigel Westbury <nigelipse@miegel.org>
I really appreciate the time you have taken to get this right. It's much better now than my original PR thanks to your comments. |
That was messed up during rebase merging. Sorry. The only change that should have been made was that no 'start' or 'exit' messages are sent to the message service if there is custom feedback. It's now fixed |
if (taskInfo.config.type === 'shell') { | ||
this.attach(taskInfo.terminalId, taskInfo.taskId); | ||
} else { | ||
this.attachProcess(taskInfo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to spawn processes and fetch the output in a different way than displaying it in a terminal widget, would creating a new task type solely for that be better? Or how should one hook onto one process but not the other, assuming that both process
and shell
tasks both should be displayed in a terminal widget by default?
Ok so I made the change to align with VS Code: #5895 If you are still interested with the change in the current PR, can you tell me how this impacts you? |
PR is stale. Feel free to re-open if still willing to get this in. |
I have been looking at moving various tasks into Theia's task framework. We have a number of tasks that provide feedback to progress monitors, output channels, and other destinations in the UI. Currently tasks that are run as processes (ie not terminals) do not provide support for extenders to do this (just start and exit messages courtesy of @elaihau in #5155).
These changes provide the required support. The changes involved are:
kill
message is supported. This is easily invoked from thecancel
token in progress monitors.I have kept the changes fairly minimal. Ideally the 'process' and 'task' packages should be more decoupled. For example, although 'task' depends on 'process', there is lot code in 'process' that is supporting terminals. If that code were refactored out into the 'terminal' package then it would also be easy for extenders to extend stuff in 'process'.
ProgressManager currently maps ids to Process objects. Ideally it would map ids to objects (eg TaskInfo) that contain at least Process and the task type. For many uses of Process it is not necessary to put in the ProcessManager, so it makes more sense if ProcessManager were TaskManager in the tasks package. This would avoid the need to hook
initClientConnection
off Process as is done in this PR.I am very happy to do the further changes too. However I cannot do that without guidance on how I can know what is considered API that can't be changed.