Skip to content

Commit

Permalink
Merge pull request #10 from ariasemis/fix-env-vars
Browse files Browse the repository at this point in the history
Fix recorder so that it doesnt capture all environment variables
  • Loading branch information
ibigbug committed Oct 15, 2020
2 parents b093005 + a4f549b commit 615903a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions PowerSession.Main/Commands/RecordCommand.cs
Expand Up @@ -2,6 +2,7 @@
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using ConPTY;
using Newtonsoft.Json;
Expand Down Expand Up @@ -67,7 +68,7 @@ private void _record(string filename, string command = null)
{
if (string.IsNullOrEmpty(command)) command = "powershell.exe";

if (_env == null) _env = Environment.GetEnvironmentVariables();
if (_env == null) _env = new Dictionary<string, string>();
_env.Add("POWERSESSION_RECORDING", "1");
_env.Add("SHELL", "powershell.exe");
_env.Add("TERM", Environment.GetEnvironmentVariable("TERMINAL_EMULATOR") ?? "NotSure");
Expand All @@ -81,7 +82,7 @@ private void _record(string filename, string command = null)
Environment = _env
};
writer.SetHeader(headerInfo);

var terminal = new Terminal(writer.GetInputStream(), writer.GetWriteStream(), width: headerInfo.Width, height: headerInfo.Height);
terminal.Record(command, _env);
Console.WriteLine("Record Finished");
Expand Down

0 comments on commit 615903a

Please sign in to comment.