Tyrrrz/CliWrap

`telnet` command is throwing 'No such file or directory' error

codewizard-dt opened this issue · 4 comments

Version

v3.6.6

Platform

.NET 8 / MacOS 12.5.1

Steps to reproduce

Very simple example

var telnet = Cli.Wrap("telnet github.com 80") | Console.WriteLine;
await telnet.ExecuteAsync();

Details

I have no issue at all running telnet github.com 80 in a terminal window. I am new to CliWrap (which is GREAT by the way) so it may be user error, but I am using CliWrap for an nslookup command without issue. For some reason telnet command is throwing this error. I'm also new to .NET. Any advice would be appreciated. It may be related to running on MacOs since the error includes Win32Exception, but .NET is supposed to be cross platform.

System.ComponentModel.Win32Exception (2): An error occurred trying to start process 'telnet gmail.com 80' with working directory '/Users/dtaylor/Repositories/EmailServices8/EmailValidation'. No such file or directory

Checklist

  • I have looked through existing issues to make sure that this bug has not been reported before
  • I have provided a descriptive title for this issue
  • I have made sure that this bug is reproducible on the latest version of the package
  • I have provided all the information needed to reproduce this bug as efficiently as possible
  • I have sponsored this project

The issue is that you did Cli.Wrap("telnet github.com 80"). The parameter to Wrap is just the executable/script path, it should not include the arguments. Do this instead:

Cli.Wrap("telnet")
   .WithArguments(["github.com", "80"])

Oh man. Wow. Duh, of course. I'm wondering if there is there a way to interact with telnet after the initial command? I've tried a few variations of output Pipes and input Pipes but can't figure it out. Any help would be much appreciated.

See #194 #191 for some ideas

Thank you for the response! I found those issues yesterday and I was able to work it out from there.