Skip to content

Error emitted in receive() when data contains only one line #1

@onlyfang

Description

@onlyfang

In function PythonShell.prototype.receive(), when data contains only one line, it is saved to lastLine by

var lastLine = lines.pop();

and lines[0] is undifined.

Code line 177

lines[0] = (this._remaining || '') + lines[0];

set lines[0] to be string 'undefined'. This will cause error to be throw at JSON.parse below.

Propose: change line 177 to

if (this._remaining) {
      lines[0] = this._remaining + lines[0];
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions