Skip to content

Commit ee9e97c

Browse files
authored
Add files via upload
1 parent 3507e7f commit ee9e97c

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

runpythonvirtual.nim

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import osproc, os, strformat
2+
3+
# ================================
4+
# HARD-CODED EXECUTABLE PATH
5+
# ================================
6+
when defined(windows):
7+
const exePath = r"C:\Programs\PythonVirtualEnv\tuivirtual\Scripts\python.exe" # Change to your executable
8+
else:
9+
const exePath = "/home/you/yourprogram" # Change for Linux/macOS
10+
11+
# ================================
12+
# MAIN
13+
# ================================
14+
15+
when isMainModule:
16+
# Collect optional arguments from command line
17+
var args: seq[string] = @[]
18+
for i in 1..paramCount():
19+
args.add(paramStr(i))
20+
21+
# Run the executable with arguments
22+
echo fmt"Running executable: {exePath} with args: {args}"
23+
let process = startProcess(exePath, args=args, options={poParentStreams})
24+
25+
# Wait for it to finish
26+
discard process.waitForExit()
27+
echo "Process finished."

0 commit comments

Comments
 (0)