1
0
Fork 0
mirror of https://github.com/Corsinvest/cv4pve-pepper.git synced 2025-02-12 10:01:53 +00:00
This commit is contained in:
Daniele Corsini 2020-08-07 16:45:09 +02:00
parent 7accc64d68
commit fb10b50918
2 changed files with 22 additions and 10 deletions

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<Version>1.3.1</Version>
<Version>1.3.2</Version>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>cv4pve-pepper</AssemblyName>
<Company>Corsinvest Srl</Company>

View file

@ -12,6 +12,7 @@
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using Corsinvest.ProxmoxVE.Api.Extension.Helpers;
using Corsinvest.ProxmoxVE.Api.Shell.Helpers;
using McMaster.Extensions.CommandLineUtils;
@ -25,11 +26,11 @@ namespace Corsinvest.ProxmoxVE.Pepper
var app = ShellHelper.CreateConsoleApp("cv4pve-pepper", "Launching SPICE on Proxmox VE");
var optVmId = app.VmIdOrNameOption().DependOn(app, CommandOptionExtension.HOST_OPTION_NAME);
var optRemoteViewer = app.Option("--viewer",
"Executable SPICE client remote viewer",
CommandOptionType.SingleValue)
.DependOn(app, CommandOptionExtension.HOST_OPTION_NAME);
optRemoteViewer.Accepts().ExistingFile();
app.OnExecute(() =>
@ -39,16 +40,27 @@ namespace Corsinvest.ProxmoxVE.Pepper
if (ret)
{
var process = new Process
{
StartInfo = new ProcessStartInfo
var startInfo = new ProcessStartInfo
{
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardOutput = false,
FileName = StringHelper.Quote(optRemoteViewer.Value()),
Arguments = StringHelper.Quote(fileName)
};
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
startInfo.FileName = "/bin/bash";
startInfo.Arguments = $"-c \"{optRemoteViewer.Value()} {fileName}\"";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
startInfo.FileName = StringHelper.Quote(optRemoteViewer.Value());
startInfo.Arguments = StringHelper.Quote(fileName);
}
var process = new Process
{
StartInfo = startInfo
};
if (app.DebugIsActive())