Skip to content

Commit

Permalink
Platforms: remove unused console output check
Browse files Browse the repository at this point in the history
The last callers of the IsConsoleOutputRedirectedToFile()
methods in the ScalarPlatform classes were removed in commit
4183579 in PR microsoft#439.

Therefore we can remove this method, which was never properly
implemented on POSIX anyway, per microsoft/VFSForGit#1355.
  • Loading branch information
chrisd8088 committed Oct 11, 2020
1 parent 5abf595 commit 4b67f90
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 41 deletions.
6 changes: 0 additions & 6 deletions Scalar.Common/Platforms/POSIX/POSIXPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,6 @@ public override string GetScalarServiceNamedPipeName(string serviceName)
return this.GetCommonAppDataRootForScalarComponent(serviceName) + ".pipe";
}

public override bool IsConsoleOutputRedirectedToFile()
{
// TODO(#1355): Implement proper check
return false;
}

public override bool IsElevated()
{
int euid = GetEuid();
Expand Down
28 changes: 0 additions & 28 deletions Scalar.Common/Platforms/Windows/WindowsPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using System.IO.Pipes;
using System.Linq;
using System.Management.Automation;
using System.Runtime.InteropServices;
using System.Security.AccessControl;
using System.Security.Principal;
using System.ServiceProcess;
Expand All @@ -28,22 +27,6 @@ public class WindowsPlatform : ScalarPlatform

private const int StillActive = 259; /* from Win32 STILL_ACTIVE */

private enum StdHandle
{
Stdin = -10,
Stdout = -11,
Stderr = -12
}

private enum FileType : uint
{
Unknown = 0x0000,
Disk = 0x0001,
Char = 0x0002,
Pipe = 0x0003,
Remote = 0x8000,
}

public WindowsPlatform() : base(underConstruction: new UnderConstructionFlags())
{
}
Expand Down Expand Up @@ -356,11 +339,6 @@ public override string GetUpgradeHighestAvailableVersionDirectory()

public override Dictionary<string, string> GetPhysicalDiskInfo(string path, bool sizeStatsOnly) => WindowsPhysicalDiskInfo.GetPhysicalDiskInfo(path, sizeStatsOnly);

public override bool IsConsoleOutputRedirectedToFile()
{
return FileType.Disk == GetFileType(GetStdHandle(StdHandle.Stdout));
}

public override FileBasedLock CreateFileBasedLock(
PhysicalFileSystem fileSystem,
ITracer tracer,
Expand Down Expand Up @@ -443,12 +421,6 @@ private static object GetValueFromRegistry(RegistryHive registryHive, string key
return value;
}

[DllImport("kernel32.dll")]
private static extern IntPtr GetStdHandle(StdHandle std);

[DllImport("kernel32.dll")]
private static extern FileType GetFileType(IntPtr hdl);

public class WindowsPlatformConstants : ScalarPlatformConstants
{
public override string ExecutableExtension
Expand Down
2 changes: 0 additions & 2 deletions Scalar.Common/ScalarPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ public string GetLogsDirectoryForGVFSComponent(string componentName)

public abstract Dictionary<string, string> GetPhysicalDiskInfo(string path, bool sizeStatsOnly);

public abstract bool IsConsoleOutputRedirectedToFile();

public abstract bool TryKillProcessTree(int processId, out int exitCode, out string error);

public abstract bool TryGetDefaultLocalCacheRoot(string enlistmentRoot, out string localCacheRoot, out string localCacheRootError);
Expand Down
5 changes: 0 additions & 5 deletions Scalar.UnitTests/Mock/Common/MockPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,6 @@ public override void InitializeEnlistmentACLs(string enlistmentPath)
throw new NotSupportedException();
}

public override bool IsConsoleOutputRedirectedToFile()
{
throw new NotSupportedException();
}

public override bool IsElevated()
{
throw new NotSupportedException();
Expand Down

0 comments on commit 4b67f90

Please sign in to comment.