Browse Source
Merge pull request #7505 from abpframework/rel-4.2
fix shell command for Alpine Linux Distribution
pull/7510/head
Halil İbrahim Kalkan
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
19 additions and
4 deletions
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs
|
|
|
@ -1,4 +1,5 @@ |
|
|
|
using System.Diagnostics; |
|
|
|
using System.IO; |
|
|
|
using System.Runtime.InteropServices; |
|
|
|
|
|
|
|
namespace Volo.Abp.Cli.Utils |
|
|
|
@ -103,14 +104,28 @@ namespace Volo.Abp.Cli.Utils |
|
|
|
|
|
|
|
public static string GetFileName() |
|
|
|
{ |
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) |
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) |
|
|
|
{ |
|
|
|
//Windows
|
|
|
|
return "cmd.exe"; |
|
|
|
} |
|
|
|
|
|
|
|
//Linux or OSX
|
|
|
|
if (File.Exists("/bin/bash")) |
|
|
|
{ |
|
|
|
//TODO: Test this. it should work for both operation systems.
|
|
|
|
return "/bin/bash"; |
|
|
|
} |
|
|
|
|
|
|
|
//Windows default.
|
|
|
|
return "cmd.exe"; |
|
|
|
if (File.Exists("/bin/sh")) |
|
|
|
{ |
|
|
|
return "/bin/sh"; //some Linux distributions like Alpine doesn't have bash
|
|
|
|
} |
|
|
|
|
|
|
|
throw new AbpException($"Cannot determine shell command for this OS! " + |
|
|
|
$"Running on OS: {System.Runtime.InteropServices.RuntimeInformation.OSDescription} | " + |
|
|
|
$"OS Architecture: {System.Runtime.InteropServices.RuntimeInformation.OSArchitecture} | " + |
|
|
|
$"Framework: {System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription} | " + |
|
|
|
$"Process Architecture{System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture}"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|