Изменения документа System. Diagnostics. Process
Редактировал(а) Alexandr Fokin 2023/05/07 13:08
От версии 1.3
отредактировано Alexandr Fokin
на 2022/06/06 14:37
на 2022/06/06 14:37
Изменить комментарий:
К данной версии нет комментариев
К версии 3.2
отредактировано Alexandr Fokin
на 2022/12/12 11:49
на 2022/12/12 11:49
Изменить комментарий:
Update document after refactoring.
Сводка
-
Свойства страницы (2 изменено, 0 добавлено, 0 удалено)
-
Объекты (0 изменено, 0 добавлено, 1 удалено)
Подробности
- Свойства страницы
-
- Название
-
... ... @@ -1,1 +1,1 @@ 1 -System.Diagnostics.Process 1 +System. Diagnostics. Process - Содержимое
-
... ... @@ -1,2 +1,41 @@ 1 1 Process.start: how to get the output? 2 2 https://stackoverflow.com/questions/4291912/process-start-how-to-get-the-output 3 + 4 +EXECUTE A BASH SCRIPT VIA C#/.NET CORE 5 +https://jackma.com/2019/04/20/execute-a-bash-script-via-c-net-core/ 6 + 7 +---- 8 + 9 +Template 10 + 11 +{{code language="c#"}} 12 +ProcessStartInfo info = new ProcessStartInfo(); 13 +// fill info ... 14 +info.RedirectStandardOutput = true; 15 +info.RedirectStandardError = true; 16 + 17 +//token.ThrowIfCancellationRequested(); 18 +using Process process = Process.Start(info); 19 +try 20 +{ 21 + await process.WaitForExitAsync(token); 22 +} 23 +catch (OperationCanceledException) 24 +{ 25 + process.Kill(true); 26 + await process.WaitForExitAsync(); 27 + throw; 28 +} 29 + 30 +var outputString = await process.StandardOutput.ReadToEndAsync(); 31 +var errorString = await process.StandardError.ReadToEndAsync(); 32 + 33 +if (process.ExitCode == 0) 34 +{ 35 + //Successe 36 +} 37 +else 38 +{ 39 + //Error 40 +} 41 +{{/code}}
- XWiki.XWikiComments[0]
-
- Автор
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.cccc1808 - Комментарий
-
... ... @@ -1,2 +1,0 @@ 1 -Process.start: how to get the output? 2 -https://stackoverflow.com/questions/4291912/process-start-how-to-get-the-output - Дата
-
... ... @@ -1,1 +1,0 @@ 1 -2021-08-15 19:02:28.390