mirror of
https://github.com/Corsinvest/cv4pve-pepper.git
synced 2025-02-12 18:11:53 +00:00
parent
7accc64d68
commit
fb10b50918
2 changed files with 22 additions and 10 deletions
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<Version>1.3.1</Version>
|
<Version>1.3.2</Version>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
<AssemblyName>cv4pve-pepper</AssemblyName>
|
<AssemblyName>cv4pve-pepper</AssemblyName>
|
||||||
<Company>Corsinvest Srl</Company>
|
<Company>Corsinvest Srl</Company>
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using Corsinvest.ProxmoxVE.Api.Extension.Helpers;
|
using Corsinvest.ProxmoxVE.Api.Extension.Helpers;
|
||||||
using Corsinvest.ProxmoxVE.Api.Shell.Helpers;
|
using Corsinvest.ProxmoxVE.Api.Shell.Helpers;
|
||||||
using McMaster.Extensions.CommandLineUtils;
|
using McMaster.Extensions.CommandLineUtils;
|
||||||
|
@ -25,11 +26,11 @@ namespace Corsinvest.ProxmoxVE.Pepper
|
||||||
var app = ShellHelper.CreateConsoleApp("cv4pve-pepper", "Launching SPICE on Proxmox VE");
|
var app = ShellHelper.CreateConsoleApp("cv4pve-pepper", "Launching SPICE on Proxmox VE");
|
||||||
|
|
||||||
var optVmId = app.VmIdOrNameOption().DependOn(app, CommandOptionExtension.HOST_OPTION_NAME);
|
var optVmId = app.VmIdOrNameOption().DependOn(app, CommandOptionExtension.HOST_OPTION_NAME);
|
||||||
|
|
||||||
var optRemoteViewer = app.Option("--viewer",
|
var optRemoteViewer = app.Option("--viewer",
|
||||||
"Executable SPICE client remote viewer",
|
"Executable SPICE client remote viewer",
|
||||||
CommandOptionType.SingleValue)
|
CommandOptionType.SingleValue)
|
||||||
.DependOn(app, CommandOptionExtension.HOST_OPTION_NAME);
|
.DependOn(app, CommandOptionExtension.HOST_OPTION_NAME);
|
||||||
|
|
||||||
optRemoteViewer.Accepts().ExistingFile();
|
optRemoteViewer.Accepts().ExistingFile();
|
||||||
|
|
||||||
app.OnExecute(() =>
|
app.OnExecute(() =>
|
||||||
|
@ -39,16 +40,27 @@ namespace Corsinvest.ProxmoxVE.Pepper
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
var process = new Process
|
var startInfo = new ProcessStartInfo
|
||||||
{
|
|
||||||
StartInfo = new ProcessStartInfo
|
|
||||||
{
|
{
|
||||||
UseShellExecute = false,
|
UseShellExecute = false,
|
||||||
CreateNoWindow = true,
|
CreateNoWindow = true,
|
||||||
RedirectStandardOutput = false,
|
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())
|
if (app.DebugIsActive())
|
||||||
|
|
Loading…
Reference in a new issue