virtualshell 1.0.1__tar.gz → 1.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {virtualshell-1.0.1 → virtualshell-1.0.2}/PKG-INFO +4 -4
- {virtualshell-1.0.1 → virtualshell-1.0.2}/README.md +3 -3
- {virtualshell-1.0.1 → virtualshell-1.0.2}/cpp/include/virtual_shell.hpp +1 -1
- {virtualshell-1.0.1 → virtualshell-1.0.2}/cpp/src/binder.cpp +1 -1
- {virtualshell-1.0.1 → virtualshell-1.0.2}/demo.py +9 -11
- {virtualshell-1.0.1 → virtualshell-1.0.2}/pyproject.toml +1 -1
- virtualshell-1.0.2/src/virtualshell/_version.py +1 -0
- {virtualshell-1.0.1 → virtualshell-1.0.2}/src/virtualshell/shell.py +1 -1
- virtualshell-1.0.1/src/virtualshell/_version.py +0 -1
- {virtualshell-1.0.1 → virtualshell-1.0.2}/.github/workflows/workflow.yml +0 -0
- {virtualshell-1.0.1 → virtualshell-1.0.2}/.gitignore +0 -0
- {virtualshell-1.0.1 → virtualshell-1.0.2}/CMakeLists.txt +0 -0
- {virtualshell-1.0.1 → virtualshell-1.0.2}/LICENSE +0 -0
- {virtualshell-1.0.1 → virtualshell-1.0.2}/cpp/src/virtual_shell.cpp +0 -0
- {virtualshell-1.0.1 → virtualshell-1.0.2}/src/virtualshell/__init__.py +0 -0
- {virtualshell-1.0.1 → virtualshell-1.0.2}/src/virtualshell/errors.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: virtualshell
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.2
|
4
4
|
Summary: High-performance PowerShell bridge (C++ pybind11 backend)
|
5
5
|
Keywords: powershell,automation,shell,cpp,pybind11
|
6
6
|
Author: Kim-Andre Myrvold
|
@@ -343,8 +343,8 @@ By default you get a Python dataclass:
|
|
343
343
|
```python
|
344
344
|
@dataclass(frozen=True)
|
345
345
|
class ExecutionResult:
|
346
|
-
|
347
|
-
|
346
|
+
out: str
|
347
|
+
err: str
|
348
348
|
exit_code: int
|
349
349
|
success: bool
|
350
350
|
execution_time: float
|
@@ -355,7 +355,7 @@ Pass `as_dataclass=False` to receive the raw C++ result object.
|
|
355
355
|
### Timeouts
|
356
356
|
|
357
357
|
* Every method accepts a `timeout` (or `per_command_timeout`) in seconds.
|
358
|
-
* On timeout: `success=False`, `exit_code=-1`, `
|
358
|
+
* On timeout: `success=False`, `exit_code=-1`, `err` contains `"timeout"`.
|
359
359
|
* Async futures resolve with the timeout result; late output is dropped in C++.
|
360
360
|
|
361
361
|
---
|
@@ -124,8 +124,8 @@ By default you get a Python dataclass:
|
|
124
124
|
```python
|
125
125
|
@dataclass(frozen=True)
|
126
126
|
class ExecutionResult:
|
127
|
-
|
128
|
-
|
127
|
+
out: str
|
128
|
+
err: str
|
129
129
|
exit_code: int
|
130
130
|
success: bool
|
131
131
|
execution_time: float
|
@@ -136,7 +136,7 @@ Pass `as_dataclass=False` to receive the raw C++ result object.
|
|
136
136
|
### Timeouts
|
137
137
|
|
138
138
|
* Every method accepts a `timeout` (or `per_command_timeout`) in seconds.
|
139
|
-
* On timeout: `success=False`, `exit_code=-1`, `
|
139
|
+
* On timeout: `success=False`, `exit_code=-1`, `err` contains `"timeout"`.
|
140
140
|
* Async futures resolve with the timeout result; late output is dropped in C++.
|
141
141
|
|
142
142
|
---
|
@@ -94,7 +94,7 @@ public:
|
|
94
94
|
* @brief Configuration for the PowerShell process.
|
95
95
|
*/
|
96
96
|
struct Config {
|
97
|
-
std::string powershellPath = "pwsh
|
97
|
+
std::string powershellPath = "pwsh"; ///< Path to the PowerShell executable
|
98
98
|
std::string workingDirectory = ""; ///< Working directory (empty = current directory)
|
99
99
|
bool captureOutput = true; ///< Capture stdout
|
100
100
|
bool captureError = true; ///< Capture stderr
|
@@ -10,11 +10,10 @@ def example_concurrent_work():
|
|
10
10
|
"""
|
11
11
|
print("=== Concurrent Work Example ===")
|
12
12
|
|
13
|
-
with Shell() as sh:
|
14
|
-
|
15
|
-
print("Setting up PowerShell function
|
16
|
-
sh.run("function
|
17
|
-
sh.run("$global:i = 0")
|
13
|
+
with Shell(timeout_seconds=30) as sh:
|
14
|
+
|
15
|
+
print("Setting up PowerShell function...")
|
16
|
+
sh.run("function SayHey { Start-Sleep -Milliseconds 10000; echo 'Hey from PowerShell!' }")
|
18
17
|
|
19
18
|
# Results storage
|
20
19
|
async_results = []
|
@@ -26,9 +25,8 @@ def example_concurrent_work():
|
|
26
25
|
async_results.append(r.out.strip())
|
27
26
|
|
28
27
|
# Start a long-running PowerShell command asynchronously
|
29
|
-
print("Starting async PowerShell execution
|
30
|
-
|
31
|
-
future = sh.run_async(to_run, callback=async_callback)
|
28
|
+
print("Starting async PowerShell execution")
|
29
|
+
future = sh.run_async("SayHey", callback=async_callback)
|
32
30
|
|
33
31
|
print("Now doing other work while PowerShell runs in background..., max 50 iterations")
|
34
32
|
|
@@ -53,8 +51,8 @@ def example_concurrent_work():
|
|
53
51
|
# Wait for async to complete if it hasn't already
|
54
52
|
if not future.done():
|
55
53
|
print("Waiting for PowerShell to finish...")
|
56
|
-
future.result()
|
57
|
-
|
54
|
+
future.result() # This will block until poweshell finnishes the Job
|
55
|
+
|
58
56
|
elapsed = time.time() - start_time
|
59
57
|
|
60
58
|
print(f"\n=== Results ===")
|
@@ -144,7 +142,7 @@ def example_progress_monitoring():
|
|
144
142
|
- isComplete: True when the batch has finished
|
145
143
|
- allResults: List of all ExecutionResults (filled at completion)
|
146
144
|
"""
|
147
|
-
msg = f"Progress: {progress.currentCommand}/{progress.totalCommands} - Last: {progress.lastResult.
|
145
|
+
msg = f"Progress: {progress.currentCommand}/{progress.totalCommands} - Last: {progress.lastResult.out.strip()}"
|
148
146
|
progress_updates.append(msg)
|
149
147
|
print(f" {msg}")
|
150
148
|
|
@@ -9,7 +9,7 @@ build-backend = "scikit_build_core.build"
|
|
9
9
|
[project]
|
10
10
|
name = "virtualshell"
|
11
11
|
description = "High-performance PowerShell bridge (C++ pybind11 backend)"
|
12
|
-
version = "1.0.
|
12
|
+
version = "1.0.2"
|
13
13
|
readme = "README.md"
|
14
14
|
license = { file = "LICENSE" }
|
15
15
|
authors = [{ name = "Kim-Andre Myrvold" }]
|
@@ -0,0 +1 @@
|
|
1
|
+
version = "1.0.2"
|
@@ -116,7 +116,7 @@ def _raise_on_failure(
|
|
116
116
|
"""
|
117
117
|
if res.success:
|
118
118
|
return
|
119
|
-
err = (res.
|
119
|
+
err = (res.err or "")
|
120
120
|
if res.exit_code == -1 and "timeout" in err.lower():
|
121
121
|
raise ExecutionTimeoutError(f"{label} timed out after {timeout_used}s")
|
122
122
|
if raise_on_error:
|
@@ -1 +0,0 @@
|
|
1
|
-
version = "1.0.1"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|