@@ -143,7 +143,7 @@ public func run<
143
143
// MARK: - Custom Execution Body
144
144
145
145
/// Run an executable with given parameters and a custom closure
146
- /// to manage the running subprocess' lifetime and its IOs .
146
+ /// to manage the running subprocess' lifetime and stream its standard output .
147
147
/// - Parameters:
148
148
/// - executable: The executable to run.
149
149
/// - arguments: The arguments to pass to the executable.
@@ -152,23 +152,19 @@ public func run<
152
152
/// - platformOptions: The platform specific options to use
153
153
/// when running the executable.
154
154
/// - input: The input to send to the executable.
155
- /// - output: How to manage the executable standard ouput.
156
155
/// - error: How to manager executable standard error.
157
156
/// - isolation: the isolation context to run the body closure.
158
157
/// - body: The custom execution body to manually control the running process
159
- /// - Returns a ExecutableResult type containing the return value
158
+ /// - Returns an executableResult type containing the return value
160
159
/// of the closure.
161
- #if SubprocessSpan
162
- @available ( SubprocessSpan, * )
163
- #endif
164
160
public func run< Result, Input: InputProtocol , Error: OutputProtocol > (
165
161
_ executable: Executable ,
166
162
arguments: Arguments = [ ] ,
167
163
environment: Environment = . inherit,
168
164
workingDirectory: FilePath ? = nil ,
169
165
platformOptions: PlatformOptions = PlatformOptions ( ) ,
170
166
input: Input = . none,
171
- error: Error ,
167
+ error: Error = . discarded ,
172
168
isolation: isolated ( any Actor ) ? = #isolation,
173
169
body: ( ( Execution , AsyncBufferSequence ) async throws -> Result )
174
170
) async throws -> ExecutionResult < Result > where Error. OutputType == Void {
@@ -208,9 +204,21 @@ public func run<Result, Input: InputProtocol, Error: OutputProtocol>(
208
204
}
209
205
}
210
206
211
- #if SubprocessSpan
212
- @available ( SubprocessSpan, * )
213
- #endif
207
+ /// Run an executable with given parameters and a custom closure
208
+ /// to manage the running subprocess' lifetime and stream its standard error.
209
+ /// - Parameters:
210
+ /// - executable: The executable to run.
211
+ /// - arguments: The arguments to pass to the executable.
212
+ /// - environment: The environment in which to run the executable.
213
+ /// - workingDirectory: The working directory in which to run the executable.
214
+ /// - platformOptions: The platform specific options to use
215
+ /// when running the executable.
216
+ /// - input: The input to send to the executable.
217
+ /// - output: How to manager executable standard output.
218
+ /// - isolation: the isolation context to run the body closure.
219
+ /// - body: The custom execution body to manually control the running process
220
+ /// - Returns an executableResult type containing the return value
221
+ /// of the closure.
214
222
public func run< Result, Input: InputProtocol , Output: OutputProtocol > (
215
223
_ executable: Executable ,
216
224
arguments: Arguments = [ ] ,
@@ -258,16 +266,28 @@ public func run<Result, Input: InputProtocol, Output: OutputProtocol>(
258
266
}
259
267
}
260
268
261
- #if SubprocessSpan
262
- @available ( SubprocessSpan, * )
263
- #endif
269
+ /// Run an executable with given parameters and a custom closure
270
+ /// to manage the running subprocess' lifetime, write to its
271
+ /// standard input, and stream its standard output.
272
+ /// - Parameters:
273
+ /// - executable: The executable to run.
274
+ /// - arguments: The arguments to pass to the executable.
275
+ /// - environment: The environment in which to run the executable.
276
+ /// - workingDirectory: The working directory in which to run the executable.
277
+ /// - platformOptions: The platform specific options to use
278
+ /// when running the executable.
279
+ /// - error: How to manager executable standard error.
280
+ /// - isolation: the isolation context to run the body closure.
281
+ /// - body: The custom execution body to manually control the running process
282
+ /// - Returns an executableResult type containing the return value
283
+ /// of the closure.
264
284
public func run< Result, Error: OutputProtocol > (
265
285
_ executable: Executable ,
266
286
arguments: Arguments = [ ] ,
267
287
environment: Environment = . inherit,
268
288
workingDirectory: FilePath ? = nil ,
269
289
platformOptions: PlatformOptions = PlatformOptions ( ) ,
270
- error: Error ,
290
+ error: Error = . discarded ,
271
291
isolation: isolated ( any Actor ) ? = #isolation,
272
292
body: ( ( Execution , StandardInputWriter , AsyncBufferSequence ) async throws -> Result )
273
293
) async throws -> ExecutionResult < Result > where Error. OutputType == Void {
@@ -291,9 +311,21 @@ public func run<Result, Error: OutputProtocol>(
291
311
}
292
312
}
293
313
294
- #if SubprocessSpan
295
- @available ( SubprocessSpan, * )
296
- #endif
314
+ /// Run an executable with given parameters and a custom closure
315
+ /// to manage the running subprocess' lifetime, write to its
316
+ /// standard input, and stream its standard error.
317
+ /// - Parameters:
318
+ /// - executable: The executable to run.
319
+ /// - arguments: The arguments to pass to the executable.
320
+ /// - environment: The environment in which to run the executable.
321
+ /// - workingDirectory: The working directory in which to run the executable.
322
+ /// - platformOptions: The platform specific options to use
323
+ /// when running the executable.
324
+ /// - output: How to manager executable standard output.
325
+ /// - isolation: the isolation context to run the body closure.
326
+ /// - body: The custom execution body to manually control the running process
327
+ /// - Returns an executableResult type containing the return value
328
+ /// of the closure.
297
329
public func run< Result, Output: OutputProtocol > (
298
330
_ executable: Executable ,
299
331
arguments: Arguments = [ ] ,
@@ -324,25 +356,20 @@ public func run<Result, Output: OutputProtocol>(
324
356
}
325
357
}
326
358
327
- /// Run a executable with given parameters and a custom closure
328
- /// to manage the running subprocess' lifetime and write to its
329
- /// standard input via `StandardInputWriter`
359
+ /// Run an executable with given parameters and a custom closure
360
+ /// to manage the running subprocess' lifetime, write to its
361
+ /// standard input, and stream its standard output and standard error.
330
362
/// - Parameters:
331
363
/// - executable: The executable to run.
332
364
/// - arguments: The arguments to pass to the executable.
333
365
/// - environment: The environment in which to run the executable.
334
366
/// - workingDirectory: The working directory in which to run the executable.
335
367
/// - platformOptions: The platform specific options to use
336
368
/// when running the executable.
337
- /// - output:How to handle executable's standard output
338
- /// - error: How to handle executable's standard error
339
369
/// - isolation: the isolation context to run the body closure.
340
370
/// - body: The custom execution body to manually control the running process
341
- /// - Returns a ExecutableResult type containing the return value
371
+ /// - Returns an executableResult type containing the return value
342
372
/// of the closure.
343
- #if SubprocessSpan
344
- @available ( SubprocessSpan, * )
345
- #endif
346
373
public func run< Result> (
347
374
_ executable: Executable ,
348
375
arguments: Arguments = [ ] ,
@@ -384,7 +411,7 @@ public func run<Result>(
384
411
385
412
// MARK: - Configuration Based
386
413
387
- /// Run a `Configuration` asynchrously and returns
414
+ /// Run a `Configuration` asynchronously and returns
388
415
/// a `CollectedResult` containing the output of the child process.
389
416
/// - Parameters:
390
417
/// - configuration: The `Subprocess` configuration to run.
@@ -476,19 +503,15 @@ public func run<
476
503
)
477
504
}
478
505
479
- /// Run a executable with given parameters specified by a `Configuration`
506
+ /// Run an executable with given parameters specified by a `Configuration`
480
507
/// - Parameters:
481
508
/// - configuration: The `Subprocess` configuration to run.
482
- /// - output: The method to use for redirecting the standard output.
483
- /// - error: The method to use for redirecting the standard error.
484
509
/// - isolation: the isolation context to run the body closure.
485
510
/// - body: The custom configuration body to manually control
486
- /// the running process and write to its standard input.
487
- /// - Returns a ExecutableResult type containing the return value
511
+ /// the running process, write to its standard input, stream
512
+ /// its standard output and standard error.
513
+ /// - Returns an executableResult type containing the return value
488
514
/// of the closure.
489
- #if SubprocessSpan
490
- @available ( SubprocessSpan, * )
491
- #endif
492
515
public func run< Result> (
493
516
_ configuration: Configuration,
494
517
isolation: isolated ( any Actor) ? = #isolation,
@@ -511,7 +534,7 @@ public func run<Result>(
511
534
512
535
// MARK: - Detached
513
536
514
- /// Run a executable with given parameters and return its process
537
+ /// Run an executable with given parameters and return its process
515
538
/// identifier immediately without monitoring the state of the
516
539
/// subprocess nor waiting until it exits.
517
540
///
@@ -528,9 +551,6 @@ public func run<Result>(
528
551
/// - output: A file descriptor to bind to the subprocess' standard output.
529
552
/// - error: A file descriptor to bind to the subprocess' standard error.
530
553
/// - Returns: the process identifier for the subprocess.
531
- #if SubprocessSpan
532
- @available ( SubprocessSpan, * )
533
- #endif
534
554
public func runDetached(
535
555
_ executable: Executable,
536
556
arguments: Arguments = [ ] ,
@@ -551,7 +571,7 @@ public func runDetached(
551
571
return try runDetached ( config, input: input, output: output, error: error)
552
572
}
553
573
554
- /// Run a executable with given configuration and return its process
574
+ /// Run an executable with given configuration and return its process
555
575
/// identifier immediately without monitoring the state of the
556
576
/// subprocess nor waiting until it exits.
557
577
///
@@ -564,9 +584,6 @@ public func runDetached(
564
584
/// - output: A file descriptor to bind to the subprocess' standard output.
565
585
/// - error: A file descriptor to bind to the subprocess' standard error.
566
586
/// - Returns: the process identifier for the subprocess.
567
- #if SubprocessSpan
568
- @available ( SubprocessSpan, * )
569
- #endif
570
587
public func runDetached(
571
588
_ configuration: Configuration,
572
589
input: FileDescriptor? = nil ,
0 commit comments