GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix global tool issues around exit code, command line parameters and … · PowerShell/PowerShell@42b599d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/Microsoft.PowerShell.GlobalTool.Shim
    • GlobalToolShim.cs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/Microsoft.PowerShell.GlobalTool.Shim/GlobalToolShim.cs‎

Copy file name to clipboardExpand all lines: src/Microsoft.PowerShell.GlobalTool.Shim/GlobalToolShim.cs
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ public class EntryPoint
2121
/// <summary>
2222
/// Entry point for the global tool.
2323
/// </summary>
24-
/// <param name="args">Arguments passed to the global tool.</param>
25-
public static void Main(string[] args)
24+
/// <param name="args">Arguments passed to the global tool.</param>'
25+
/// <returns>Exit code returned by pwsh.</returns>
26+
public static int Main(string[] args)
2627
{
2728
var currentPath = new FileInfo(System.Reflection.Assembly.GetEntryAssembly().Location).Directory.FullName;
2829
var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
@@ -31,11 +32,13 @@ public static void Main(string[] args)
3132

3233
string argsString = args.Length > 0 ? string.Join(" ", args) : null;
3334
var pwshPath = Path.Combine(currentPath, platformFolder, PwshDllName);
34-
string processArgs = string.IsNullOrEmpty(argsString) ? $"{pwshPath}" : $"{pwshPath} -c {argsString}";
35+
string processArgs = string.IsNullOrEmpty(argsString) ? $"\"{pwshPath}\"" : $"\"{pwshPath}\" {argsString}";
3536

3637
if (File.Exists(pwshPath))
3738
{
38-
System.Diagnostics.Process.Start("dotnet", processArgs).WaitForExit();
39+
var process = System.Diagnostics.Process.Start("dotnet", processArgs);
40+
process.WaitForExit();
41+
return process.ExitCode;
3942
}
4043
else
4144
{

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.