PipeTarget.ToDelegate overload #183
Unanswered
delphianaus
asked this question in
Q&A
Replies: 5 comments 4 replies
-
I mean, |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yes thats it.
i am doing this for example
var cmd = Cli.Wrap("ffmpeg.exe").
WithArguments(args => args
.Add(argsx)).
WithWorkingDirectory(defaultpath).ExecuteAsync();
I want to use observe in this above example. Some examples would be good.
things i want to observe are StartedCommandEvent, StandardErrorCommandEvent
& ExitedCommandEvent
Thanks great work
Justin
…On Fri, Dec 2, 2022 at 8:56 PM Oleksii Holub ***@***.***> wrote:
I mean, .Observe() is pretty much that. What exactly are you trying to
achieve?
—
Reply to this email directly, view it on GitHub
<#183 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIQPOZHOPAFRZNENDUPQX7DWLHBU5ANCNFSM6AAAAAASROWCTM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Can you do it before calling executeasync() ? like witharguments?
…On Sun, Dec 4, 2022 at 10:17 PM Oleksii Holub ***@***.***> wrote:
Do this:
cmd.Observe().Subscribe(cmdEvent => /* pattern match */);
You might need to add the System.Reactive.Linq package
—
Reply to this email directly, view it on GitHub
<#183 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIQPOZHU72EFIBP3SPBRQ6LWLR4TBANCNFSM6AAAAAASROWCTM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Hey i want to know how i can send a control-c to a process i have started
with Cli.Wrap
My Code is
var clidb1 = Cli.Wrap("mongod.exe").
WithArguments(args => args
.Add("--port").Add("40001")
.Add("--dbpath").Add($"C:/YouTubeHelper/Data/db1")
.Add("--replSet").Add("--YTReplSet").Add("--bind_ip_all")).
WithStandardErrorPipe(PipeTarget.ToDelegate(EDB1_Handler)).
WithStandardOutputPipe(PipeTarget.ToDelegate(DB1_Handler)).
ExecuteAsync().ConfigureAwait(false);
i need the process to end with control-c before cli.Wrap terminates is self
( ie application shutdown).
Kind Regards
Justin
…On Fri, Dec 2, 2022 at 8:56 PM Oleksii Holub ***@***.***> wrote:
I mean, .Observe() is pretty much that. What exactly are you trying to
achieve?
—
Reply to this email directly, view it on GitHub
<#183 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIQPOZHOPAFRZNENDUPQX7DWLHBU5ANCNFSM6AAAAAASROWCTM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
2 replies
-
No Not That , i am talking about physically sending a control-c event to
the underlying process before killing it , the mongodb deamon on windows
will shutdown when you send a control c.
something like this i found worked for 4 process ( 3 for db ,1 for windows
service)
Process[] ps12 = Process.GetProcessesByName("mongod");
foreach (var p in ps12)
{
GenerateConsoleCtrlEvent(ConsoleCtrlEvent.CTRL_C, (int)p.SessionId);
Thread.Sleep(150);
p.Kill();
}
it would be handy if you could go send Key and also a Kill on the
cli.Wraps task it returns
Justin
…On Sat, Feb 4, 2023 at 10:35 PM Oleksii Holub ***@***.***> wrote:
https://github.com/Tyrrrz/CliWrap#timeout-and-cancellation
—
Reply to this email directly, view it on GitHub
<#183 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIQPOZBOICILLK5DIGRFLHDWVY5JRANCNFSM6AAAAAASROWCTM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
is it possible to overload PipeTarget.ToDelegate so you can pass the commandEvent you normally get from ListenAsync() or add something like PipeTarget.ToListenAsync
Also for the argments.add if you pass in a empty list could you skip adding "" if the list is empty
this would be great
Beta Was this translation helpful? Give feedback.
All reactions