Robert Muehsig
2017-11-15 23:42:15 +01:00
parent d1b42fa007
commit 5c14e585cf
4 changed files with 34 additions and 9 deletions

View File

@@ -49,7 +49,13 @@ namespace ElectronNET.CLI.Commands
Console.WriteLine($"Build ASP.NET Core App for {platformInfo.NetCorePublishRid}...");
ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} --output \"{tempBinPath}\"", Directory.GetCurrentDirectory());
var resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} --output \"{tempBinPath}\"", Directory.GetCurrentDirectory());
if (resultCode != 0)
{
Console.WriteLine("Error occured during dotnet publish.");
return false;
}
DeployEmbeddedElectronFiles.Do(tempPath);

View File

@@ -51,7 +51,13 @@ namespace ElectronNET.CLI.Commands
var platformInfo = GetTargetPlatformInformation.Do(string.Empty);
string tempBinPath = Path.Combine(tempPath, "bin");
ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} --output \"{tempBinPath}\"", aspCoreProjectPath);
var resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} --output \"{tempBinPath}\"", aspCoreProjectPath);
if (resultCode != 0)
{
Console.WriteLine("Error occured during dotnet publish.");
return false;
}
DeployEmbeddedElectronFiles.Do(tempPath);

View File

@@ -6,7 +6,7 @@ namespace ElectronNET.CLI
{
public class ProcessHelper
{
public static void CmdExecute(string command, string workingDirectoryPath, bool output = true, bool waitForExit = true)
public static int CmdExecute(string command, string workingDirectoryPath, bool output = true, bool waitForExit = true)
{
using (Process cmd = new Process())
{
@@ -28,10 +28,21 @@ namespace ElectronNET.CLI
cmd.StartInfo.CreateNoWindow = true;
cmd.StartInfo.UseShellExecute = false;
cmd.StartInfo.WorkingDirectory = workingDirectoryPath;
int returnCode = 0;
if (output)
{
cmd.OutputDataReceived += (s, e) => Console.WriteLine(e.Data);
cmd.ErrorDataReceived += (s, e) => Console.WriteLine(e.Data);
cmd.ErrorDataReceived += (s, e) =>
{
// we can't just use cmd.ExitCode, because
// we delegate it to cmd.exe, which runs fine
// but we can catch any error here and return
// 1 if something fails
returnCode = 1;
Console.WriteLine(e.Data);
};
}
cmd.Start();
@@ -46,6 +57,8 @@ namespace ElectronNET.CLI
{
cmd.WaitForExit();
}
return returnCode;
}
}
}

View File

@@ -22,9 +22,9 @@ dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build
echo "-- linux (dev-build)"
dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build linux
REM Be aware, that for non-electronnet-dev environments the correct
REM invoke command would be dotnet electronize ...
:: Be aware, that for non-electronnet-dev environments the correct
:: invoke command would be dotnet electronize ...
REM Not supported on Windows Systems, because of SymLinks...
REM echo "-- osx"
REM dotnet electronize build osx
:: Not supported on Windows Systems, because of SymLinks...
:: echo "-- osx"
:: dotnet electronize build osx