forked from flutter/flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Windows] Remove the usage of
SETLOCAL ENABLEDELAYEDEXPANSION
from …
…bat scripts. (flutter#106861)
- Loading branch information
Showing
5 changed files
with
62 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@ECHO off | ||
REM Copyright 2014 The Flutter Authors. All rights reserved. | ||
REM Use of this source code is governed by a BSD-style license that can be | ||
REM found in the LICENSE file. | ||
|
||
REM A script to exit caller script with the last status code. | ||
REM This can be used with ampersand without `SETLOCAL ENABLEDELAYEDEXPANSION`. | ||
REM | ||
REM To use this script like `exit`, do not use with the CALL command. | ||
REM Without CALL, this script can exit caller script, but with CALL, | ||
REM this script returns back to caller and does not exit caller. | ||
|
||
exit /B %ERRORLEVEL% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
packages/flutter_tools/test/commands.shard/permeable/script_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2014 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
// @dart = 2.8 | ||
|
||
import 'dart:io'; | ||
|
||
import 'package:flutter_tools/src/cache.dart'; | ||
import 'package:flutter_tools/src/globals.dart' as globals; | ||
|
||
import '../../src/common.dart'; | ||
import '../../src/context.dart'; | ||
|
||
void main() { | ||
setUpAll(() { | ||
Cache.disableLocking(); | ||
}); | ||
|
||
testUsingContext('flutter command can receive `!`, avoiding expansion by cmd.exe', () async { | ||
final String flutterBin = globals.fs.path.join(getFlutterRoot(), 'bin', 'flutter.bat'); | ||
|
||
final ProcessResult exec = await Process.run( | ||
flutterBin, | ||
<String>[ | ||
'!', | ||
], | ||
workingDirectory: Cache.flutterRoot, | ||
); | ||
// If ENABLEDELAYEDEXPANSION is enabled, the argument `!` is removed, | ||
// and flutter runs without any arguments. | ||
expect(exec.exitCode, 64); | ||
expect(exec.stderr, contains('Could not find a command named "!"')); | ||
}, | ||
skip: !Platform.isWindows, // [intended] relies on Windows's cmd.exe | ||
); | ||
} |