这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@rchande
Copy link

@rchande rchande commented Aug 7, 2019

No description provided.


var text = reader.ReadToEnd();
var events = text.Split("\r\n")
var events = text.Split(Environment.NewLine)
Copy link
Contributor

Choose a reason for hiding this comment

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

We might be running on a different system from where the input was sent, or a notebook authored on one OS might be opened on another, so we should split on both \n and \r\n. I think we have code elsewhere doing that and it might be a worthwhile utility method to pull out.

Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated, what if the SubmitCode.Code contains newlines?

Copy link
Author

Choose a reason for hiding this comment

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

A single command/response must not contain newlines because we read them by calling console.ReadLine() (effectively). The code we're looking at here is the test code, which just pushes everything into a single stream and then reads it all back at once (hence the splitting)

Copy link
Contributor

Choose a reason for hiding this comment

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

What's the process when someone submits a cell with multiple lines of code inside it? If we read the input to the end, instead of line by line, could it simplify this case?

Copy link
Author

Choose a reason for hiding this comment

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

I think it's not valid json to have an unescaped line break in a string. It's fair for us to expect clients to escape their newlines.

Copy link
Author

Choose a reason for hiding this comment

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

Will add a test for this though

@rchande rchande changed the title wip: stdio kernel server stdio kernel server Aug 9, 2019
@rchande rchande merged commit 158efa1 into dotnet:master Aug 9, 2019
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.

3 participants