-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.fs
36 lines (29 loc) · 1.35 KB
/
Program.fs
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
open System
open System.Diagnostics
let runScriptWithInput numberOfNodes numberOfRequests =
let scriptPath = "./Chord.fsx" // Replace with the actual path to your FSX script
let arguments = sprintf "%d %d" numberOfNodes numberOfRequests
let startInfo = new ProcessStartInfo("dotnet", sprintf "fsi %s %s" scriptPath arguments)
startInfo.RedirectStandardInput <- true
let process = new Process()
process.StartInfo <- startInfo
process.Start()
process.StandardInput.WriteLine(arguments)
process.WaitForExit()
let processInput numberOfNodes numberOfRequests =
// Your logic to process the input goes here
runScriptWithInput numberOfNodes numberOfRequests
[<EntryPoint>]
let main argv =
if argv.Length = 2 then
let numberOfNodes, numberOfRequests =
try
int argv.[0], int argv.[1] // Get the first and second command-line arguments as integers
with
| :? System.FormatException ->
printfn "Invalid input. Please enter valid integers for NumberOfNodes and NumberOfRequests."
0,0 // Set the exit code to 1 to indicate an error
processInput numberOfNodes numberOfRequests
else
printfn "Please provide two command-line arguments: NumberOfNodes and NumberOfRequests."
0 // Return an integer exit code (0 means success)