File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
src/Microsoft.PowerShell.GlobalTool.Shim Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,9 @@ public class EntryPoint
21
21
/// <summary>
22
22
/// Entry point for the global tool.
23
23
/// </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 )
26
27
{
27
28
var currentPath = new FileInfo ( System . Reflection . Assembly . GetEntryAssembly ( ) . Location ) . Directory . FullName ;
28
29
var isWindows = RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ;
@@ -31,11 +32,13 @@ public static void Main(string[] args)
31
32
32
33
string argsString = args . Length > 0 ? string . Join ( " " , args ) : null ;
33
34
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 } ";
35
36
36
37
if ( File . Exists ( pwshPath ) )
37
38
{
38
- System . Diagnostics . Process . Start ( "dotnet" , processArgs ) . WaitForExit ( ) ;
39
+ var process = System . Diagnostics . Process . Start ( "dotnet" , processArgs ) ;
40
+ process . WaitForExit ( ) ;
41
+ return process . ExitCode ;
39
42
}
40
43
else
41
44
{
You can’t perform that action at this time.
0 commit comments