diff --git a/cli-main.js b/cli-main.js index 04467880..39951c6d 100755 --- a/cli-main.js +++ b/cli-main.js @@ -157,7 +157,7 @@ if (options.nodeVersion) { if (options.fix) { const result = xo.lintText(stdin, options).results[0]; // If there is no output, pass the stdin back out - console.log(result.output || stdin); + process.stdout.write(result.output || stdin); return; } diff --git a/test/cli-main.js b/test/cli-main.js index 2bb9e303..73079175 100644 --- a/test/cli-main.js +++ b/test/cli-main.js @@ -17,9 +17,9 @@ test('fix option', async t => { test('fix option with stdin', async t => { const {stdout} = await main(['--fix', '--stdin'], { - input: 'console.log()\n' + input: 'console.log()' }); - t.is(stdout.trim(), 'console.log();'); + t.is(stdout, 'console.log();'); }); test('stdin-filename option with stdin', async t => {