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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: virtualshell
3
- Version: 1.0.1
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
- output: str
347
- error: str
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`, `error` contains `"timeout"`.
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
- output: str
128
- error: str
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`, `error` contains `"timeout"`.
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.exe"; ///< Path to the PowerShell executable
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
@@ -522,7 +522,7 @@ PYBIND11_MODULE(_core, m) {
522
522
  }, "Create a new VirtualShell instance", py::arg("config"));
523
523
 
524
524
  // Metadata
525
- m.attr("__version__") = "1.0.1";
525
+ m.attr("__version__") = "1.0.2";
526
526
  m.attr("__author__") = "Kim-Andre Myrvold";
527
527
  }
528
528
 
@@ -10,11 +10,10 @@ def example_concurrent_work():
10
10
  """
11
11
  print("=== Concurrent Work Example ===")
12
12
 
13
- with Shell() as sh:
14
- # Set up a PowerShell function that takes some time to execute
15
- print("Setting up PowerShell function with 10 ms delay per increment...")
16
- sh.run("function SlowInc { Start-Sleep -Milliseconds 10; $global:i += 1; $global:i }")
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 (1000 increments)...")
30
- to_run = "SlowInc;" * 1000
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() # This will block until completion
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.output.strip()}"
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.1"
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.error or "")
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