Skip to content

Commit 51ac900

Browse files
brianquinlanCommit Queue
authored andcommitted
[doc, io]: Add a note to indicate the batch file execution behavior on Windows.
Change-Id: I6f61af46e7e9e96282127fea919c8e79948356d4 CoreLibraryReviewExempt: documentation only Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364941 Commit-Queue: Brian Quinlan <[email protected]> Reviewed-by: Alexander Aprelev <[email protected]>
1 parent 23b360b commit 51ac900

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

sdk/lib/io/process.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,18 @@ abstract interface class Process {
321321
/// shell. On Linux and OS X, `/bin/sh` is used, while
322322
/// `%WINDIR%\system32\cmd.exe` is used on Windows.
323323
///
324+
/// **NOTE**: On Windows, if [executable] is a batch file
325+
/// ('*.bat' or '*.cmd'), it may be launched by the operating system in a
326+
/// system shell regardless of the value of [runInShell]. This could result in
327+
/// arguments being parsed according to shell rules. For example:
328+
///
329+
/// ```
330+
/// void main() async {
331+
/// // Will launch notepad.
332+
/// Process.start('test.bat', ['test&notepad.exe']);
333+
/// }
334+
/// ```
335+
///
324336
/// Users must read all data coming on the [stdout] and [stderr]
325337
/// streams of processes started with `Process.start`. If the user
326338
/// does not read all data on the streams the underlying system
@@ -388,6 +400,18 @@ abstract interface class Process {
388400
/// shell. On Linux and OS X, `/bin/sh` is used, while
389401
/// `%WINDIR%\system32\cmd.exe` is used on Windows.
390402
///
403+
/// **NOTE**: On Windows, if [executable] is a batch file
404+
/// ('*.bat' or '*.cmd'), it may be launched by the operating system in a
405+
/// system shell regardless of the value of [runInShell]. This could result in
406+
/// arguments being parsed according to shell rules. For example:
407+
///
408+
/// ```
409+
/// void main() async {
410+
/// // Will launch notepad.
411+
/// await Process.run('test.bat', ['test&notepad.exe']);
412+
/// }
413+
/// ```
414+
///
391415
/// The encoding used for decoding `stdout` and `stderr` into text is
392416
/// controlled through [stdoutEncoding] and [stderrEncoding]. The
393417
/// default encoding is [systemEncoding]. If `null` is used no

0 commit comments

Comments
 (0)