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

[DO NOT MERGE] Add a simple SFDX: SObject Describe Account Command for testing #111

Closed
wants to merge 1 commit into from

Conversation

vazexqi
Copy link
Contributor

@vazexqi vazexqi commented Sep 13, 2017

What does this PR do?

Adds a simple top-level command that is used to fetch the result of a describe call.

This is meant to illustrate the problem that for large data from the CLI, the results could be truncated. Now, before anyone is alarmed, this only happens under very special circumstances and doesn't affect any of the commands that we have in the released version of our extensions:

stdout-truncated

  1. This seems to be on OS X.
  2. This only seems to happen when you use child_process.spawn and are using the process.stdout.on('data',....) events.

This might be related to

where we might need to change the SFDX CLI to call process.stdout._handle.setBlocking(true)

However, having an interactive top-level command that reproduces this issue makes it easier for us to debug this on different platforms.

What issues does this PR fix or reference?

This PR is meant to serve as an easy way for us to debug this and discuss solutions with traceability.

@@ -22,9 +22,9 @@ export interface CancellationToken {

export class CliCommandExecutor {
private readonly command: Command;
private readonly options: ExecOptions;
private readonly options: SpawnOptions;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a legit typing issue that we need to fix. So far it has not affected us since we don't use any of the other options.

@@ -77,12 +78,27 @@ export class CommandExecution {
childProcess,
'error'
) as Observable<Error | undefined>;
this.processExitSubject.subscribe(next => {
this.processErrorSubject.subscribe(next => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is another error that should be fixed.

childProcess.stdout.setEncoding('utf8');

childProcess.stdout.on('error', err => {
console.log(err);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just logging to see if we have any errors on stdout and we don't.

cwd: vscode.workspace.rootPath,
stdio: [
'pipe',
'pipe', // fs.openSync(path.join(vscode.workspace.rootPath!, 'stdout.txt'), 'w'),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A possible, but annoying workaround, is to pipe the result to another stream.
Using a temp file seems to gather all the data.
However, with that, you lose the ability to stream data as it arrives.

@vazexqi
Copy link
Contributor Author

vazexqi commented Sep 13, 2017

The CI tests will fail since I'm adding a lot of logging. Like I mentioned, this is not for merging but for others to take out this branch, try it out and have a discussion on the PR.

@vazexqi
Copy link
Contributor Author

vazexqi commented Sep 13, 2017

process-exit-truncates-stdout

Confirming that nodejs/node#2360 still happens on Node v7.10.0 on OS X.

@vazexqi
Copy link
Contributor Author

vazexqi commented Sep 13, 2017

The next version of the CLI, aka V6, should explicitly flush the buffer for us. See https://github.com/heroku/cli-engine/blob/master/src/cli.js#L118-L123

Closing this for now, will reopen if the issue reappears in V6.

@vazexqi vazexqi closed this Sep 13, 2017
@vazexqi vazexqi mentioned this pull request Sep 18, 2017
@vazexqi vazexqi deleted the nick/wip-processing-large-data branch September 19, 2017 01:04
@vazexqi vazexqi restored the nick/wip-processing-large-data branch September 28, 2017 17:36
@vazexqi
Copy link
Contributor Author

vazexqi commented Sep 28, 2017

I just tested this with V6 of the CLI and it still exhibits this truncated issue.

screen shot 2017-09-28 at 10 44 25 am

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.

1 participant