forked from dotnet/crank
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply Job Object in delayed child process (dotnet#654)
Co-authored-by: Theodore Tsirpanis <teo@tsirpanis.gr>
- Loading branch information
1 parent
1d0bf34
commit 26b2f9f
Showing
7 changed files
with
88 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/Microsoft.Crank.JobOjectWrapper/Microsoft.Crank.JobObjectWrapper.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFrameworks>net6.0;net7.0</TargetFrameworks> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Diagnostics; | ||
|
||
if (args.Length == 0) | ||
{ | ||
Console.WriteLine("Arguments are missing."); | ||
Environment.Exit(-1); | ||
} | ||
|
||
Console.WriteLine("Job Object Wrapper"); | ||
Console.WriteLine("Waiting for Job Object to be setup..."); | ||
|
||
await Task.Delay(1000); | ||
|
||
var process = new Process() | ||
{ | ||
StartInfo = { | ||
FileName = args[0], | ||
Arguments = string.Join(" ", args[1..]), | ||
UseShellExecute = false, | ||
RedirectStandardOutput = true, | ||
RedirectStandardError = true, | ||
} | ||
}; | ||
|
||
Console.WriteLine("Starting process..."); | ||
Console.WriteLine($"Filename: {process.StartInfo.FileName}"); | ||
Console.WriteLine($"Args: {process.StartInfo.Arguments}"); | ||
|
||
process.Start(); | ||
Console.WriteLine($"##ChildProcessId:{process.Id}"); | ||
process.WaitForExit(); | ||
|
||
Console.WriteLine(process.StandardOutput.ReadToEnd()); | ||
|
||
await Task.Delay(1000); |