Skip to content

Commit c0d5ee7

Browse files
committed
Use stderr for errors in solcjs
1 parent ae27539 commit c0d5ee7

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

solcjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var files = argv._;
4747
var destination = argv['output-dir'] || '.'
4848

4949
function abort (msg) {
50-
console.log(msg || 'Error occured');
50+
console.error(msg || 'Error occured');
5151
process.exit(1);
5252
}
5353

@@ -90,7 +90,7 @@ if (!output) {
9090
abort('No output from compiler');
9191
} else if (output['errors']) {
9292
for (var error in output['errors']) {
93-
console.log(output['errors'][error]);
93+
console.error(output['errors'][error]);
9494
}
9595
}
9696

@@ -100,7 +100,7 @@ function writeFile (file, content) {
100100
file = path.join(destination, file);
101101
fs.writeFile(file, content, function (err) {
102102
if (err) {
103-
console.log('Failed to write ' + file + ': ' + err);
103+
console.error('Failed to write ' + file + ': ' + err);
104104
}
105105
});
106106
}

test/cli.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ tape('CLI', function (t) {
66
t.test('--version', function (st) {
77
var spt = spawn(st, './solcjs --version');
88
spt.stdout.match(RegExp(pkg.version + '(-[^a-zA-A0-9.+]+)?(\\+[^a-zA-Z0-9.-]+)?'));
9+
spt.stderr.empty();
910
spt.end();
1011
});
1112

@@ -17,7 +18,7 @@ tape('CLI', function (t) {
1718

1819
t.test('no mode specified', function (st) {
1920
var spt = spawn(st, './solcjs test/DAO/Token.sol');
20-
spt.stdout.match(/^Invalid option selected/);
21+
spt.stderr.match(/^Invalid option selected/);
2122
spt.end();
2223
});
2324

@@ -30,7 +31,7 @@ tape('CLI', function (t) {
3031

3132
t.test('invalid file specified', function (st) {
3233
var spt = spawn(st, './solcjs --bin test/fileNotFound.sol');
33-
spt.stdout.match(/^Error reading /);
34+
spt.stderr.match(/^Error reading /);
3435
spt.end();
3536
});
3637

0 commit comments

Comments
 (0)