Closed bnuzhouwei closed 3 years ago
I'm not sure I understand the question. Are you attempting to build and getting that exception? This project is cross-compat so it should work on linux using mono. Nevertheless, I'd suggest using netcore instead since it adopted mono :)
Closing due to no response.
The error still exits in Mono:
import clr, System
from Pty.Net import *
class Pty:
def __init__(self, name, cols=180, rows=500):
self.name = name
self.started = ph.dd.now()
self.host = "127.0.0.1"
self.cols = cols
self.rows = rows
app = "/bin/bash"
options = PtyOptions()
options.Name = name
options.Cols = 180
options.Rows = 500
options.Cwd = "/root"
options.App = app
self.pty = PtyProvider.SpawnAsync(options, System.Threading.CancellationToken()).GetAwaiter().GetResult()
pty = Pty("lo")
System.IO.IOException: Invalid handle to path "[Unknown]"
at System.IO.FileStream.Init (Microsoft.Win32.SafeHandles.SafeFileHandle safeHandle, System.IO.FileAccess access, System.Boolean ownsHandle, System.Int32 bufferSize, System.Boolean isAsync, System.Boolean isConsoleWrapper) [0x0006a] in <a5426229307d4283803b6b7e2cdc86e0>:0
at System.IO.FileStream..ctor (Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.IO.FileAccess access, System.Int32 bufferSize, System.Boolean isAsync) [0x00011] in <a5426229307d4283803b6b7e2cdc86e0>:0
at Pty.Net.Unix.PtyStream..ctor (System.Int32 fd, System.IO.FileAccess fileAccess) [0x0000d] in <c5151a3d755045f2a06d1d18f46d910c>:0
at (wrapper remoting-invoke-with-check) Pty.Net.Unix.PtyStream..ctor(int,System.IO.FileAccess)
at Pty.Net.Unix.PtyConnection..ctor (System.Int32 controller, System.Int32 pid) [0x00012] in <c5151a3d755045f2a06d1d18f46d910c>:0
at Pty.Net.Linux.PtyConnection..ctor (System.Int32 controller, System.Int32 pid) [0x00000] in <c5151a3d755045f2a06d1d18f46d910c>:0
at Pty.Net.Linux.PtyProvider.StartTerminalAsync (Pty.Net.PtyOptions options, System.Diagnostics.TraceSource trace, System.Threading.CancellationToken cancellationToken) [0x0011f] in <c5151a3d755045f2a06d1d18f46d910c>:0
at Pty.Net.PtyProvider.SpawnAsync (Pty.Net.PtyOptions options, System.Threading.CancellationToken cancellationToken) [0x0007b] in <c5151a3d755045f2a06d1d18f46d910c>:0
at (wrapper delegate-invoke)
I have the same error on Ubuntu 22.04 and mono. On windows it works fine. Any input about what could be wrong? :)
System.Native is not available in .NET and mono, how to make it usable for mono?