src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts/_resolveCwd
function _resolveCwd(cwd: string, variableResolver: VariableResolver | undefined, logService?: ILogService): string | undefined {
	if (variableResolver) {
		try {
			return variableResolver(cwd);
		} catch (e) {
			logService?.error('Could not resolve terminal cwd', e);
			return undefined;
		}
	}
	return cwd;
}