-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
37 lines (32 loc) · 1.05 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.Arguments = "/c node app.js -i";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardInput = true;
p.OutputDataReceived += (s, e) => Console.WriteLine(e.Data);
p.ErrorDataReceived += (s, e) => Console.WriteLine(e.Data);
p.Start();
p.BeginOutputReadLine();
p.BeginErrorReadLine();
var stdin = p.StandardInput;
stdin.WriteLine("console.log('Server succffuel starting')");
stdin.Flush();
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Сервер успешно запущен!");
p.WaitForExit();
p.Close();
}
}