From 638fb719df4e7fa57121443729fe2d8e5873a48a Mon Sep 17 00:00:00 2001 From: Kare Morstol Date: Tue, 22 Sep 2015 01:56:25 +0200 Subject: [PATCH] Make more properties of MainShellContext lazy. Will be important later on if/when I implement truly global standard input/output redirection. --- SwiftShell/Context.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SwiftShell/Context.swift b/SwiftShell/Context.swift index 049476b..b3d5c08 100644 --- a/SwiftShell/Context.swift +++ b/SwiftShell/Context.swift @@ -29,11 +29,11 @@ public final class MainShellContext: ShellContextType { // TODO: get encoding from environmental variable LC_CTYPE public var encoding = NSUTF8StringEncoding - public var env = NSProcessInfo.processInfo().environment as [String: String] + public lazy var env = NSProcessInfo.processInfo().environment as [String: String] - public var stdin = NSFileHandle.fileHandleWithStandardInput() //as ReadableStreamType - public var stdout = NSFileHandle.fileHandleWithStandardOutput() //as WriteableStreamType - public var stderror = NSFileHandle.fileHandleWithStandardError() //as WriteableStreamType + public lazy var stdin = NSFileHandle.fileHandleWithStandardInput() //as ReadableStreamType + public lazy var stdout = NSFileHandle.fileHandleWithStandardOutput() //as WriteableStreamType + public lazy var stderror = NSFileHandle.fileHandleWithStandardError() //as WriteableStreamType /** The current working directory.