mirror of
https://github.com/hashicorp/setup-terraform.git
synced 2025-12-25 04:37:06 +00:00
fix: Escape backticks in stdout and stderr
This commit is contained in:
parent
a75f1a3cce
commit
679784b708
3 changed files with 13 additions and 2 deletions
|
|
@ -34,7 +34,8 @@ class OutputListener {
|
|||
get contents () {
|
||||
return this._buff
|
||||
.map(chunk => chunk.toString())
|
||||
.join('');
|
||||
.join('')
|
||||
.replace(/`/g, '\\`');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,4 +14,13 @@ describe('output-listener', () => {
|
|||
listen(Buffer.from('baz'));
|
||||
expect(listener.contents).toEqual('foobarbaz');
|
||||
});
|
||||
|
||||
it('escape backticks', () => {
|
||||
const listener = new OutputListener();
|
||||
const listen = listener.listener;
|
||||
listen(Buffer.from('foo'));
|
||||
listen(Buffer.from('`bar`'));
|
||||
listen(Buffer.from('baz'));
|
||||
expect(listener.contents).toEqual('foo\\`bar\\`baz');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue