mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-30 04:39:03 +01:00
Don't emit ANSI codes to Windows terminals that don't support them (#403)
These codes *could* be supported on all Windows terminals, but dart-lang/sdk#28614 means that they won't actually be recognized. Partially addresses #395
This commit is contained in:
parent
3269632715
commit
df7c1030cf
@ -1,3 +1,7 @@
|
||||
## 1.9.1
|
||||
|
||||
* Don't emit ANSI codes to Windows terminals that don't support them.
|
||||
|
||||
## 1.9.0
|
||||
|
||||
### Node API
|
||||
|
@ -147,8 +147,9 @@ class ExecutableOptions {
|
||||
bool get indented => _ifParsed('indented') as bool;
|
||||
|
||||
/// Whether to use ANSI terminal colors.
|
||||
bool get color =>
|
||||
_options.wasParsed('color') ? _options['color'] as bool : hasTerminal;
|
||||
bool get color => _options.wasParsed('color')
|
||||
? _options['color'] as bool
|
||||
: supportsAnsiEscapes;
|
||||
|
||||
/// Whether to silence normal output.
|
||||
bool get quiet => _options['quiet'] as bool;
|
||||
|
@ -39,6 +39,10 @@ bool get hasTerminal => false;
|
||||
/// Whether we're running as Node.JS.
|
||||
bool get isNode => false;
|
||||
|
||||
/// Whether this process is connected to a terminal that supports ANSI escape
|
||||
/// sequences.
|
||||
bool get supportsAnsiEscapes => false;
|
||||
|
||||
/// The current working directory.
|
||||
String get currentPath => null;
|
||||
|
||||
|
@ -228,6 +228,9 @@ bool get isWindows => _process.platform == 'win32';
|
||||
|
||||
bool get isNode => true;
|
||||
|
||||
// Node seems to support ANSI escapes on all terminals.
|
||||
bool get supportsAnsiEscapes => hasTerminal;
|
||||
|
||||
String get currentPath => _process.cwd();
|
||||
|
||||
@JS("process.stdout.isTTY")
|
||||
|
@ -23,6 +23,15 @@ bool get hasTerminal => io.stdout.hasTerminal;
|
||||
|
||||
bool get isNode => false;
|
||||
|
||||
bool get supportsAnsiEscapes {
|
||||
if (!hasTerminal) return false;
|
||||
|
||||
// We don't trust [io.stdout.supportsAnsiEscapes] except on Windows because it
|
||||
// relies on the TERM environment variable which has many false negatives.
|
||||
if (!isWindows) return true;
|
||||
return io.stdout.supportsAnsiEscapes;
|
||||
}
|
||||
|
||||
String get currentPath => io.Directory.current.path;
|
||||
|
||||
String readFile(String path) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: sass
|
||||
version: 1.9.0
|
||||
version: 1.9.1-dev
|
||||
description: A Sass implementation in Dart.
|
||||
author: Dart Team <misc@dartlang.org>
|
||||
homepage: https://github.com/sass/dart-sass
|
||||
|
Loading…
Reference in New Issue
Block a user