Skip to content

Evaluating expressions: {ok, Result} term is not unwrapped when Result includes new line character \n #2947

@bsnote

Description

@bsnote

Replicating the issue:

$ rebar3 new release foo
===> Writing foo/apps/foo/src/foo_app.erl
===> Writing foo/apps/foo/src/foo_sup.erl
===> Writing foo/apps/foo/src/foo.app.src
===> Writing foo/rebar.config
===> Writing foo/config/sys.config
===> Writing foo/config/vm.args
===> Writing foo/.gitignore
===> Writing foo/LICENSE.md
===> Writing foo/README.md
$ cd foo
$ rebar3 release
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling foo
===> Assembling release foo-0.1.0...
===> Release successfully assembled: _build/default/rel/foo
$ _build/default/rel/foo/bin/foo daemon
$ _build/default/rel/foo/bin/foo eval "\"hello there\"."
"hello there"
$ _build/default/rel/foo/bin/foo eval "\"hello\\nthere\"."
{ok, "hello
there"}

As it can be seen, the result of executing _build/default/rel/foo/bin/foo eval "\"hello there\"." is

"hello there"

and the result of executing _build/default/rel/foo/bin/foo eval "\"hello\\nthere\"." is

{ok, "hello
there"}

In the second case the {ok, Result} term is not unwrapped because the following sed in the generated script does not match multiline input:

echo "$result" | sed 's/^{ok, \(.*\)}$/\1/'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions