DirectMyFile / console.dart

Console Library
Other
107 stars 24 forks source link

Cannot measure terminal when run through 'pub run' #7

Closed emilniklas closed 9 years ago

emilniklas commented 9 years ago

When running a file through pub run, Console cannot measure the console window. This might be an unsolvable problem if pub run runs everything in some sort of sandboxed mode, I don't know. But I thought you might want to know!

bin/main.dart

import 'package:console/console.dart';

main() {
  print(Console.columns);
}
$ pub run bin/main

This throws an error message as follows:

Unhandled exception:
StdoutException: Could not get terminal size, OS Error: Inappropriate ioctl for device, errno = 25
#0      Stdout._terminalSize (dart:io-patch/stdio_patch.dart:74)
#1      Stdout._terminalColumns (dart:io-patch/stdio_patch.dart:68)
#2      Stdout.terminalColumns (dart:io/stdio.dart:182)
#3      StdioConsoleAdapter.columns (package:console/src/adapter.dart:21:29)
#4      Console.columns (package:console/src/base.dart:181:38)
#5      main (http://localhost:63740/main.dart:4:17)
#6      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:255)
#7      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:142)
emilniklas commented 9 years ago

Hey, I just realized!

It's stdout.terminalColumns that throws the exception. I'll take this to the Dart authors, instead!

seaneagan commented 9 years ago

I think this is the bug you want to star:

https://code.google.com/p/dart/issues/detail?id=21821

Can you add your use case as a comment there?