Skip to content

Commit 615903a

Browse files
authored
Merge pull request #10 from ariasemis/fix-env-vars
Fix recorder so that it doesnt capture all environment variables
2 parents b093005 + a4f549b commit 615903a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

PowerSession.Main/Commands/RecordCommand.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{
33
using System;
44
using System.Collections;
5+
using System.Collections.Generic;
56
using System.IO;
67
using ConPTY;
78
using Newtonsoft.Json;
@@ -67,7 +68,7 @@ private void _record(string filename, string command = null)
6768
{
6869
if (string.IsNullOrEmpty(command)) command = "powershell.exe";
6970

70-
if (_env == null) _env = Environment.GetEnvironmentVariables();
71+
if (_env == null) _env = new Dictionary<string, string>();
7172
_env.Add("POWERSESSION_RECORDING", "1");
7273
_env.Add("SHELL", "powershell.exe");
7374
_env.Add("TERM", Environment.GetEnvironmentVariable("TERMINAL_EMULATOR") ?? "NotSure");
@@ -81,7 +82,7 @@ private void _record(string filename, string command = null)
8182
Environment = _env
8283
};
8384
writer.SetHeader(headerInfo);
84-
85+
8586
var terminal = new Terminal(writer.GetInputStream(), writer.GetWriteStream(), width: headerInfo.Width, height: headerInfo.Height);
8687
terminal.Record(command, _env);
8788
Console.WriteLine("Record Finished");

0 commit comments

Comments
 (0)