1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-25 02:58:02 +02:00

Embedded console / terminal support

This commit is contained in:
Brian Fiete 2024-07-23 07:56:23 +02:00
parent 60817eec48
commit 20a8e3327c
28 changed files with 2317 additions and 690 deletions

View file

@ -10,6 +10,7 @@ namespace System.Diagnostics
bool mRedirectStandardOutput = false;
bool mRedirectStandardError = false;
bool mCreateNoWindow = false;
bool mActivateWindow = false;
public bool ErrorDialog;
//public Windows.Handle ErrorDialogParentHandle;
//public ProcessWindowStyle WindowStyle;
@ -26,6 +27,7 @@ namespace System.Diagnostics
public bool RedirectStandardOutput { get { return mRedirectStandardOutput; } set { mRedirectStandardOutput = value; } };
public bool RedirectStandardError { get { return mRedirectStandardError; } set { mRedirectStandardError = value; } };
public bool CreateNoWindow { get { return mCreateNoWindow; } set { mCreateNoWindow = value; } };
public bool ActivateWindow { get { return mActivateWindow; } set { mActivateWindow = value; } };
Encoding StandardOutputEncoding;
Encoding StandardErrorEncoding;

View file

@ -70,6 +70,8 @@ namespace System.Diagnostics
}
if (startInfo.CreateNoWindow)
spawnFlags |= .NoWindow;
if (!startInfo.ActivateWindow)
spawnFlags |= .NoActivateWindow;
if (startInfo.RedirectStandardInput)
spawnFlags |= .RedirectStdInput;
if (startInfo.RedirectStandardOutput)

View file

@ -24,6 +24,7 @@ namespace System.IO
case OpenError(FileOpenError);
case ReadError(FileReadError);
case SeekError;
case PipeListening;
}
static class File

View file

@ -72,6 +72,8 @@ namespace System.IO
{
case .Timeout:
return .Err(.ReadError(.Timeout));
case .PipeListening:
return .Err(.PipeListening);
default:
return .Err(.ReadError(.Unknown));
}

View file

@ -109,5 +109,11 @@ namespace System.IO
return .Ok;
}
public void Clear()
{
mMemory.Clear();
mPosition = 0;
}
}
}

View file

@ -26,6 +26,8 @@ namespace System.IO
public Result<void, FileOpenError> Create(StringView machineName, StringView pipeName, PipeOptions options)
{
Close();
Runtime.Assert(mBfpFile == null);
String path = scope String();
@ -64,6 +66,8 @@ namespace System.IO
public Result<void, FileOpenError> Open(StringView machineName, StringView pipeName, PipeOptions options)
{
Close();
Runtime.Assert(mBfpFile == null);
String path = scope String();

View file

@ -31,7 +31,8 @@ namespace System
PartialData,
TempFileError,
Timeout,
NotEmpty
NotEmpty,
PipeListening
};
public struct BfpSpawn {}
@ -263,6 +264,7 @@ namespace System
ErrorDialog = 0x400,
Window_Hide = 0x800,
Window_Maximized = 0x1000,
NoActivateWindow = 0x2000
};
public enum BfpKillFlags : int32
@ -455,6 +457,7 @@ namespace System
InsufficientBuffer = (int)Result.InsufficientBuffer,
Timeout = (int)Result.Timeout,
NotEmpty = (int)Result.NotEmpty,
PipeListening = (int)Result.PipeListening,
};
#if !BF_RUNTIME_DISABLE