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

Newline parsing isn't working for me. #632

Closed
angarc opened this issue Jul 2, 2020 · 5 comments · Fixed by #684
Closed

Newline parsing isn't working for me. #632

angarc opened this issue Jul 2, 2020 · 5 comments · Fixed by #684
Labels
bug Something isn't working

Comments

@angarc
Copy link

angarc commented Jul 2, 2020

I'm using version 4.0.1.

I'm making a request to my server. The response i'm getting I'm outputting to the console via console.log() and this is what I'm seeing:

Object { output: "hello world\nhello world\nhello world\n" }

I outputting this output message to the terminal, but this is what it looks like:

hello world hello world hello world 

I even explicitly added the noNewlineParsing={false} option, but no luck.

Any ideas as to how I can go about fixing this?

@linuswillner
Copy link
Owner

That is definitely odd. Could you show me the code you're using to fetch the data and sending it to the terminal?

@linuswillner linuswillner added the needs more info More information is required label Jul 3, 2020
@angarc
Copy link
Author

angarc commented Jul 4, 2020

Sure! Here is the whole thing

commands = {
    python: {
      fn: (arg1) => {
        const terminal = this.terminal.current
        if (arg1 === undefined) {
          return "Sorry, we don't support running python directly in the browser.\n" +
            "At any given point, you can only run the script of the file you're working on."
        }

        if (arg1 !== this.props.problemTitle) {
          return `File "${arg1}" non found.\n`
        }
        // send api request
        const code = this.props.code
        const problemId = this.props.problemId
        axios({
          method: 'get',
          url: `${URI}api/run/${problemId}`,
          params: {
            code
          }
        }).then((response) => {
          console.log(response.data)
          terminal.pushToStdout(response.data.output)
        }).catch((error) => {
          console.log(error)
        });
        return ""
      }
    }
  }

If you're wondering what's in the response.data, it's this:

{ output: "hello world\nhello world\nhello world\n" }

@linuswillner linuswillner added bug Something isn't working and removed needs more info More information is required labels Jul 8, 2020
@linuswillner
Copy link
Owner

Hi, thanks for the report, I'll be investigating this in detail ASAP.

@adrientremblay
Copy link

Doesn't work for me either :(

@linuswillner linuswillner added the in progress Being worked on label Aug 17, 2020
linuswillner added a commit that referenced this issue Aug 17, 2020
There was a bug in the EOL parser where it would only recognise escaped newline characters, and not actual newlines. This issue was caused by a faulty testing methodology.
@linuswillner linuswillner removed the in progress Being worked on label Aug 17, 2020
@linuswillner
Copy link
Owner

Fixed in 12110e8. Will be pushed out with the next version.

@linuswillner linuswillner added bug Something isn't working and removed bug Something isn't working labels Aug 17, 2020
@linuswillner linuswillner mentioned this issue Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants