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

Fix #2961: Output of short-lived tasks is not shown #9409

Merged
merged 1 commit into from
May 20, 2021

Conversation

EstherPerelman
Copy link
Contributor

@EstherPerelman EstherPerelman commented Apr 28, 2021

Signed-off-by: Esther Perelman [email protected]

Most of PR description copied from #7776

What it does

How to test

  • Run a task that lives only for a short time, like echo hello, and check the task terminal widget for its title and output;
  • Please also check if the change introduced any new bugs into Theia.
Demo:
  • Before
    short-lived-task-before
  • After
    short-lived-task-after

Review checklist

Reminder for reviewers

@@ -103,8 +103,14 @@ export class TerminalProcess extends Process {
// be ignored.
if (signal === undefined || signal === 0) {
this.emitOnExit(code, undefined);
this.onProcessExited();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More info on exit event ant its params you can find here

Comment on lines -1063 to -1066
// Get the list of all available running tasks.
const runningTasks: TaskInfo[] = await this.getRunningTasks();
// Get the corresponding task information based on task id if available.
const taskInfo: TaskInfo | undefined = runningTasks.find((t: TaskInfo) => t.taskId === taskId);
Copy link
Contributor Author

@EstherPerelman EstherPerelman Apr 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In short lived tasks- the task finishes before attached, But still needed to be attached...

@EstherPerelman
Copy link
Contributor Author

@simark @marechal-p @vince-fugnitto @akosyakov or any reviewer?

Copy link
Contributor

@colin-grant-work colin-grant-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be working for me with both tasks that conclude successfully (echo hello) and those that error out (ls /non-existent-folder), and I believe it addresses the criticism of #7776 that it relied on uncertain timings. Is there any reason to worry that someone might start terminal processes that never get attached to? This seems bind the behavior of the TerminalProcess fairly tightly to a set of expectations that may only apply to the task system.

packages/process/src/node/process.ts Outdated Show resolved Hide resolved
packages/process/src/node/terminal-process.ts Outdated Show resolved Hide resolved
@colin-grant-work
Copy link
Contributor

colin-grant-work commented Apr 28, 2021

I believe this PR would also address #9350 - at least #9350 should be treated along with #2961, since they're likely the same underlying issue.

(Sorry for the accidental closure - mouse slipped to wrong button when I was posting this comment)

@EstherPerelman EstherPerelman force-pushed the Issue-2961 branch 2 times, most recently from 1dc1667 to 41bba3a Compare April 29, 2021 15:36
@colin-grant-work
Copy link
Contributor

@EstherPerelman, sorry for the delay. I will take another look at this later today or tomorrow.

@EstherPerelman EstherPerelman force-pushed the Issue-2961 branch 4 times, most recently from b088789 to 912fa52 Compare May 6, 2021 11:17
Copy link
Contributor

@colin-grant-work colin-grant-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marechal-p, I know this something you've given some thought to. Do you have any opinions about the approach adopted here? I think it works, ensures cleanup, and is relatively non-breaking, so I'm inclined to accept it, for now, but maybe there's a better option available without a major refactor?

packages/terminal/src/node/base-terminal-server.ts Outdated Show resolved Hide resolved
@@ -45,6 +46,16 @@ export class TerminalServer extends BaseTerminalServer implements ITerminalServe
this.logger.error('Error while creating terminal', error);
resolve(-1);
});

const taskTerm = this.taskTerminalFactory(options);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we're creating both a taskTerminal and a normal terminal in this Promise. Is that intended, or should we create or the other, depending on some conditional?

Copy link
Contributor Author

@EstherPerelman EstherPerelman May 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this after the builds here failed but I think it can be omitted. (removed)

@EstherPerelman EstherPerelman force-pushed the Issue-2961 branch 2 times, most recently from 11cdc55 to 1923945 Compare May 9, 2021 05:33
@EstherPerelman
Copy link
Contributor Author

@marechal-p, I know this something you've given some thought to. Do you have any opinions about the approach adopted here? I think it works, ensures cleanup, and is relatively non-breaking, so I'm inclined to accept it, for now, but maybe there's a better option available without a major refactor?

@marechal-p @colin-grant-work WDYS? Can it be merged?

Copy link
Contributor

@colin-grant-work colin-grant-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll give my tentative approval, but I'm still hoping someone else will be willing to give a look.

@EstherPerelman
Copy link
Contributor Author

@marechal-p Thank you for reviewing! I updated the code accordingly.

@paul-marechal
Copy link
Member

@EstherPerelman I am fine with the changes, thanks!

Note that I am still working on refactoring processes and terminals, and I'll have a very different implementation than what you did here, although functionality will be the same. I still need more time to finish that refactoring, and I'll be unavailable the whole week that starts May 24th. This means that I'll most likely try to merge my refactoring after the next release.

All of that to ask if you are ok with merging your change now, knowing it might be obsolete sometime later after the next release? If so let's merge this PR :)

@EstherPerelman
Copy link
Contributor Author

EstherPerelman commented May 20, 2021

All of that to ask if you are ok with merging your change now, knowing it might be obsolete sometime later after the next release? If so let's merge this PR :)

@marechal-p I'm ok with merging now, Thank you!

@paul-marechal paul-marechal merged commit d563b6b into eclipse-theia:master May 20, 2021
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

Successfully merging this pull request may close these issues.

Output of short-lived tasks is not shown
4 participants