Gah, need to use .get to handle case when environment variable isn't defined.

Otherwise it would throw a runtime exception. :-(
This commit is contained in:
H. S. Teoh 2014-08-08 14:43:17 -07:00
parent 3931c20de4
commit 310b46c992
1 changed files with 3 additions and 3 deletions

View File

@ -303,7 +303,7 @@ struct Terminal {
bool terminalInFamily(string[] terms...) {
import std.process;
import std.string;
auto term = environment["TERM"];
auto term = environment.get("TERM");
foreach(t; terms)
if(indexOf(term, t) != -1)
return true;
@ -393,9 +393,9 @@ struct Terminal {
import std.string;
import std.array;
string termcapData = environment["TERMCAP"];
string termcapData = environment.get("TERMCAP");
if(termcapData.length == 0) {
termcapData = getTermcapDatabase(environment["TERM"]);
termcapData = getTermcapDatabase(environment.get("TERM"));
}
auto e = replace(termcapData, "\\\n", "\n");