Skip to content

Conversation

@janjongboom
Copy link
Contributor

Serial monitors (like screen on macOS / Linux) expect both CR and LF characters for new lines. Due to jerryscript only printing a line feed after calls to print() this makes log messages look wrong. This patch adds a CR when it encounters a LF character in jerry_port_console or jerry_port_log for the mbedos5 target.

JerryScript-DCO-1.0-Signed-off-by: Jan Jongboom jan.jongboom@arm.com

Fix for #1426

vfprintf (stdout, format, args);
va_end (args);

if (strlen(format) == 1 && format[0] == 0x0a) { /* line feed (\n) */
Copy link
Member

Choose a reason for hiding this comment

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

If this follows the JerryScript coding style please put the { to the next line.

Copy link
Contributor

Choose a reason for hiding this comment

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

And add whitespace after the strlen() like if (strlen (format)..., right @zherczeg ?

Copy link
Member

Choose a reason for hiding this comment

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

Yes

@zherczeg
Copy link
Member

Any plans to fix the style issues?

@janjongboom janjongboom force-pushed the cr_after_lf branch 4 times, most recently from 554a701 to b9a04d7 Compare November 26, 2016 07:02
Serial monitors (like screen on macOS / Linux) expect both CR and LF characters for new lines. Due to jerryscript only printing a line feed after calls to `print()` this makes log messages look wrong. This patch adds a CR when it encounters a LF character in jerry_port_console or jerry_port_log for the mbedos5 target.

JerryScript-DCO-1.0-Signed-off-by: Jan Jongboom janjongboom@gmail.com
@janjongboom
Copy link
Contributor Author

@zherczeg Done!

@zherczeg
Copy link
Member

Thank you!
LGTM

Copy link
Contributor

@LaszloLango LaszloLango left a comment

Choose a reason for hiding this comment

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

LGTM

@LaszloLango LaszloLango added the jerry-port Related to the port API or the default port implementation label Nov 28, 2016
@zherczeg zherczeg merged commit 6a2f544 into jerryscript-project:master Nov 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jerry-port Related to the port API or the default port implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants