phoenix
phoenix copied to clipboard
Escape sequences in command parameters are incorrectly consumed by the shell
For example, echo "\n\n\n\n\n" emits only a single newline, because echo always emits a newline after its output. When that string reaches echo as a positional argument, the newline escapes are gone.
As another example, echo "hello\nfriends\n" currently outputs this from a console.log() call:
{
allowPositionals: true,
options: {
'no-newline': {
description: 'Do not print a trailing newline',
type: 'boolean',
short: 'n'
},
'enable-escapes': {
description: 'Interpret backslash escape sequences',
type: 'boolean',
short: 'e'
},
'disable-escapes': {
description: 'Disable interpreting backslash escape sequences',
type: 'boolean',
short: 'E'
}
},
args: [ 'hellofriends' ]
}
As you can see, args is 'hellofriends' without the escapes.
Just to avoid confusion since the correct output wasn't mentioned, echo "\n" should output the string "\n" literally (i.e. "\n" as a json string) unless the -e flag is specified, in which case it does output a line feed.