Task vs Process? #13644
Unanswered
dagoston93
asked this question in
General
Task vs Process?
#13644
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I would like to execute some actions when the user clicks certain buttons, such as generate some code, and run a build.
Currently, I am using terminals for the purpuse, but as far as I know, I cannot retreive the exit code, and the output of the terminal with the current
TerminalService
andTerminalWidget
APIs.In one case, I have to call an executable that writes some data to the output if it succeeds, and I need to process it before further steps can be executed by the user. Currently I am using the
TerminalWidget
'sonOutput
event and check if the syntax of the received output, and if it correct, I process it. This is obviously not the right way...Also for the build, I have to use MSYS under windows. I managed to integrate MSYS terminal this way:
So I guess, using either Tasks or processes I should be able to create a better solution.
If I am using processes or tasks, I would need to be able to display the output realtime, so not after half a minute of running and then throw all outputs at once...
I tried using tasks, but I still cannot find a way to get the result when I run a task. What I did is, I created a
TaskConfiguration
, and injected theTaskService
to my class using dependency injection. I am able to run the task using the TaskService.run() command, but I am not able to add any event listeners for the task to finish...Also if I use await and use the getExitCode() method, I get 'undefined'.I found that
TaskService
has aTaskClient
andTaskClient
hasonTaskExit()
which I think is the function that I am looking for, butTaskService
's taskServer is a protected property, thus I cannot access it. Also, if I try to get aTaskServer
using dependency injection, and call it'srun()
method nothing happens...Also if I call
TaskService.attach()
with my MSYS terminal widget, is the task going to be executed in that terminal?Also if I need the next task to be executed in the default shell after executing the task in the MSYS, do I need re-attach
TaskService
?Another question, I have to add a
TaskContribution
that looks something like this:Where
task1
andtask2
areTaskConfiguration
s. But there are arguments that i would like to change based on user input, and might be different at each task execution. Is it possible in some way to dynamically change theargs
property of theTaskConfiguration
s?I feel, that the right way would be using tasks (and have commands that execute task triggering, I guess), and not processes, but I might be wrong. What is the way developers usually implement this kind of feature?
I'm pretty sure there must be some widespread method, as this is a very common use case of a custom IDE.
(Also I'm wondering if I shall look into the Processes more, but so far I didn't manage to understand how to use the process API properly either...)
Thank's in advance for any help.
BR,
Agoston
Beta Was this translation helpful? Give feedback.
All reactions