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

use close not exit process event #6587

Closed
akosyakov opened this issue Nov 20, 2019 · 5 comments · Fixed by #6595
Closed

use close not exit process event #6587

akosyakov opened this issue Nov 20, 2019 · 5 comments · Fixed by #6595
Assignees
Labels
bug bugs found in the application process issues related to the process extension terminal issues related to the terminal

Comments

@akosyakov
Copy link
Member

akosyakov commented Nov 20, 2019

exit event does not mean that all output was delivered, close means it: https://nodejs.org/api/child_process.html#child_process_event_close

The 'close' event is emitted when the stdio streams of a child process have been closed. This is distinct from the 'exit' event, since multiple processes might share the same stdio streams.

vscode-jsonrpc uses close (https://github.com/microsoft/vscode-languageserver-node/blob/dd78cba181136e057cfcc4bb7bc17c7c78877648/jsonrpc/src/messageWriter.ts#L84) so it does not cause issues for filesystem watching, but our raw processes can miss output sometimes

@akosyakov akosyakov added bug bugs found in the application terminal issues related to the terminal process issues related to the process extension labels Nov 20, 2019
@akosyakov akosyakov self-assigned this Nov 20, 2019
@akosyakov akosyakov changed the title use close not exit event process use close not exit process event Nov 20, 2019
@akosyakov
Copy link
Member Author

I've reviewed all places. In most of cases listening to exit is harmless, since we don't do anything with stdout in exit event handler.

There are 2 places which look incorrect:

  • sometimes we can exit too early, before all stdout content is processed:
    subprocess.once('exit', (code, signal) => {
  • and raw-process, here it can break if a client expects all content from stdout to be delivered in onExit callback. In practice, it is not a case, most of clients using process.stdout.on('close', ...) already. The only client which looks suspicious is ProcesTask, it can continue emitting new lines after emitting on exit event. We should clarify what is the contract, i.e. whether stdout can deliver after exit event, can clients rely onExit event for it or should they use stdout.on('close' instead.

cc @marcdumais-work @marechal-p @elaihau

@akosyakov akosyakov removed their assignment Nov 20, 2019
@paul-marechal
Copy link
Member

From my understanding, it was implied that stdio buffers wouldn't necessarily be empty when the process exits. Just like "raw" child processes using Node's API. Did you expect it to be different?

@paul-marechal
Copy link
Member

https://nodejs.org/docs/latest-v10.x/api/child_process.html#child_process_event_close looking at the documentation, it depends what people are looking after. I think it would make more sense to fire both exit and close events so that people can choose from, depending on their use case?

@paul-marechal
Copy link
Member

Also, the code you linked in VS Code seems to be related to streams. So far, I also thought we were supposed to hook onto a process stream close event ourselves.

@akosyakov
Copy link
Member Author

akosyakov commented Nov 20, 2019

What about terminal process implementation? node-pty apparently has only exit event, it will trigger both close and exit process events?

I'm fine with adding a new event like in Node.js apis or using existing process.stdout.on('close', ...). More important to me that:

  • docs for onExit says that stdout still can produce data after this event
  • figure out whether ProcessTask should be changed to fire task exit event on process.stdout.on('close', ...) instead of onExit like right now
  • fix
    subprocess.once('exit', (code, signal) => {
    to use close instead of exit.

@paul-marechal paul-marechal self-assigned this Nov 20, 2019
kittaakos pushed a commit that referenced this issue Nov 21, 2019
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: #6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
kittaakos pushed a commit that referenced this issue Nov 22, 2019
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: #6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
akosyakov pushed a commit to akosyakov/theia that referenced this issue Feb 24, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Mar 6, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 4, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 4, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 4, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 4, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 4, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 4, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 4, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 9, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 9, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 9, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 9, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 9, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 10, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 10, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 10, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 10, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 10, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 10, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 10, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 10, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 11, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 11, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 11, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 11, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 11, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 11, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 11, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
westbury pushed a commit to ARMmbed/theia that referenced this issue Jul 12, 2020
The updated dependencies contain fix for:
 - The termination of the spawned process. The bogus process termination resulted in an empty string from the `stdout` as the `exec-path`. The empty string "path" was incorrectly normalized to `.`. (See: eclipse-theia#6587)
 - [win32]: Enhanced `git` discovery. The new logic falls back to `which`.
 - [win32]: The unstaging command. `-u` was added to ensure that git's index reflects a consistent view of the working tree after the operation has been performed.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs found in the application process issues related to the process extension terminal issues related to the terminal
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants