Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #5 from gbraad/override-distro
Browse files Browse the repository at this point in the history
  • Loading branch information
cerebrate committed Feb 24, 2021
2 parents a93aafd + baab4a0 commit d12aa93
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ containerized:
rm -rf bin/ obj/
${CONTAINER_RUNTIME} build -t dotnet-build -f images/Dockerfile.fedora .
${CONTAINER_RUNTIME} run --name runingenie-build dotnet-build sh -c "dotnet restore && dotnet publish -c Release -r win-x64"
${CONTAINER_RUNTIME} cp runingenie-build:/app/bin ./bin
${CONTAINER_RUNTIME} cp runingenie-build:/app/bin .
${CONTAINER_RUNTIME} rm runingenie-build
#${CONTAINER_RUNTIME} rmi dotnet-build # this forces a rebuild of the toolchain each time
26 changes: 16 additions & 10 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ private static string Shell
}
}

private static string Distro
{
get
{
string distro = Configuration["distro"];
return (distro != null) ? distro : String.Empty;
}
}

private static void PrintHelp ()
{
ConsoleColor oldColor = Console.ForegroundColor;
Expand Down Expand Up @@ -130,15 +139,13 @@ private static int Main (string[] args)

try
{
string shell = Program.Shell;
// Set chosen distro and shell
string distro = (Program.Distro == String.Empty) ? String.Empty : "-d {Program.Distro}";
string arguments = $"{distro} genie -c {Program.Shell}";

Process ps;
if(args.Length == 0) {
// No arguments given
ps = Process.Start (fileName: "wsl",
arguments: $"-e genie -c {shell}");
} else {
// Check through arguments, one by one.
if(args.Length > 0) {
// Check through additional arguments, one by one.
var param = new List<string> ();

foreach (var arg in args)
Expand All @@ -147,11 +154,10 @@ private static int Main (string[] args)
param.Add (item: Program.IsWindowsPath (arg: arg) ? Program.TranslatePath (path: arg) : arg);

// Execute in WSL.
ps = Process.Start (fileName: "wsl",
arguments: $"-e genie -c {shell} -c \"{string.Join (separator: ' ', values: param)}\"");
arguments = $"{arguments} -c \"{string.Join (separator: ' ', values: param)}\"";
}


ps = Process.Start (fileName: "wsl", arguments: arguments);
ps.WaitForExit ();

return ps.ExitCode;
Expand Down

0 comments on commit d12aa93

Please sign in to comment.