Commit 99c2d253 by Alan Plum

Don't rely on isTTY for reading from stdin. Fixes #451.

Actually isTTY is only relevant if we want to see whether we really have to read from stdin.
parent 98e26a9e
......@@ -134,7 +134,7 @@ module.exports = function(args) {
options.src = input[0] || null;
options.dest = options.output || input[1] || null;
if (!options.dest && (process.stdout.isTTY || process.env.isTTY)) {
if (!options.dest && !options.stdout) {
var suffix = '.css';
if (/\.css$/.test(options.src)) {
suffix = '';
......@@ -142,18 +142,17 @@ module.exports = function(args) {
options.dest = path.join(cwd, path.basename(options.src, '.scss') + suffix);
}
if (process.stdin.isTTY || process.env.isTTY) {
if (!input.length) {
if (options.src) {
run(options, emitter);
} else if (!input.length && (process.stdin.isTTY || process.env.isTTY)) {
console.error([
'Provide a sass file to render',
'',
'Example',
' Example',
' node-sass --output-style compressed foobar.scss foobar.css',
' cat foobar.scss | node-sass --output-style compressed > foobar.css'
].join('\n'));
process.exit(1);
}
run(options, emitter);
} else {
stdin(function(data) {
options.data = data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment