Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
45e212e7
Unverified
Commit
45e212e7
authored
Jul 14, 2022
by
moko256
Committed by
GitHub
Jul 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Windows] Remove the usage of `SETLOCAL ENABLEDELAYEDEXPANSION` from bat scripts. (#106861)
parent
d32aa8b2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
8 deletions
+62
-8
dart.bat
bin/dart.bat
+4
-2
flutter.bat
bin/flutter.bat
+4
-2
exit_with_errorlevel.bat
bin/internal/exit_with_errorlevel.bat
+13
-0
shared.bat
bin/internal/shared.bat
+4
-4
script_test.dart
...tter_tools/test/commands.shard/permeable/script_test.dart
+37
-0
No files found.
bin/dart.bat
View file @
45e212e7
...
...
@@ -11,7 +11,7 @@ REM work across all platforms!
REM
REM --------------------------------------------------------------------------
SETLOCAL
ENABLEDELAYEDEXPANSION
SETLOCAL
FOR %%i IN ("%~dp0..") DO SET FLUTTER_ROOT=%%~fi
...
...
@@ -23,6 +23,8 @@ SET cache_dir=%FLUTTER_ROOT%\bin\cache
SET dart_sdk_path=%cache_dir%\dart-sdk
SET dart=%dart_sdk_path%\bin\dart.exe
SET exit_with_errorlevel=%FLUTTER_ROOT%/bin/internal/exit_with_errorlevel.bat
REM Chaining the call to 'dart' and 'exit' with an ampersand ensures that
REM Windows reads both commands into memory once before executing them. This
REM avoids nasty errors that may otherwise occur when the dart command (e.g. as
...
...
@@ -31,4 +33,4 @@ REM
REM Do not use the CALL command in the next line to execute Dart. CALL causes
REM Windows to re-read the line from disk after the CALL command has finished
REM regardless of the ampersand chain.
"%dart%" %* &
exit /B !ERRORLEVEL!
"%dart%" %* &
"%exit_with_errorlevel%"
bin/flutter.bat
View file @
45e212e7
...
...
@@ -11,7 +11,7 @@ REM work across all platforms!
REM
REM --------------------------------------------------------------------------
SETLOCAL
ENABLEDELAYEDEXPANSION
SETLOCAL
REM To debug the tool, you can uncomment the following line to enable debug mode:
REM SET FLUTTER_TOOL_ARGS="--enable-asserts %FLUTTER_TOOL_ARGS%"
...
...
@@ -43,6 +43,8 @@ SET snapshot_path=%cache_dir%\flutter_tools.snapshot
SET dart_sdk_path=%cache_dir%\dart-sdk
SET dart=%dart_sdk_path%\bin\dart.exe
SET exit_with_errorlevel=%FLUTTER_ROOT%/bin/internal/exit_with_errorlevel.bat
REM Chaining the call to 'dart' and 'exit' with an ampersand ensures that
REM Windows reads both commands into memory once before executing them. This
REM avoids nasty errors that may otherwise occur when the dart command (e.g. as
...
...
@@ -51,4 +53,4 @@ REM
REM Do not use the CALL command in the next line to execute Dart. CALL causes
REM Windows to re-read the line from disk after the CALL command has finished
REM regardless of the ampersand chain.
"%dart%" --disable-dart-dev --packages="%flutter_tools_dir%\.dart_tool\package_config.json" %FLUTTER_TOOL_ARGS% "%snapshot_path%" %* &
exit /B !ERRORLEVEL!
"%dart%" --disable-dart-dev --packages="%flutter_tools_dir%\.dart_tool\package_config.json" %FLUTTER_TOOL_ARGS% "%snapshot_path%" %* &
"%exit_with_errorlevel%"
bin/internal/exit_with_errorlevel.bat
0 → 100644
View file @
45e212e7
@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%
bin/internal/shared.bat
View file @
45e212e7
...
...
@@ -11,7 +11,7 @@ REM work across all platforms!
REM
REM --------------------------------------------------------------------------
SETLOCAL
ENABLEDELAYEDEXPANSION
SETLOCAL
SET flutter_tools_dir=%FLUTTER_ROOT%\packages\flutter_tools
SET cache_dir=%FLUTTER_ROOT%\bin\cache
...
...
@@ -84,11 +84,11 @@ GOTO :after_subroutine
IF NOT EXIST "%engine_stamp%" GOTO do_sdk_update_and_snapshot
SET /P dart_required_version=<"%engine_version_path%"
SET /P dart_installed_version=<"%engine_stamp%"
IF
!dart_required_version! NEQ !dart_installed_version!
GOTO do_sdk_update_and_snapshot
IF
%dart_required_version% NEQ %dart_installed_version%
GOTO do_sdk_update_and_snapshot
IF NOT EXIST "%snapshot_path%" GOTO do_snapshot
IF NOT EXIST "%stamp_path%" GOTO do_snapshot
SET /P stamp_value=<"%stamp_path%"
IF
!stamp_value! NEQ !compilekey!
GOTO do_snapshot
IF
%stamp_value% NEQ %compilekey%
GOTO do_snapshot
SET pubspec_yaml_path=%flutter_tools_dir%\pubspec.yaml
SET pubspec_lock_path=%flutter_tools_dir%\pubspec.lock
FOR /F %%i IN ('DIR /B /O:D "%pubspec_yaml_path%" "%pubspec_lock_path%"') DO SET newer_file=%%i
...
...
@@ -104,7 +104,7 @@ GOTO :after_subroutine
ECHO Checking Dart SDK version... 1>&2
SET update_dart_bin=%FLUTTER_ROOT%\bin\internal\update_dart_sdk.ps1
REM Escape apostrophes from the executable path
SET "update_dart_bin=
!update_dart_bin:'=''!
"
SET "update_dart_bin=
%update_dart_bin:'=''%
"
REM PowerShell command must have exit code set in order to prevent all non-zero exit codes from being translated
REM into 1. The exit code 2 is used to detect the case where the major version is incorrect and there should be
REM no subsequent retries.
...
...
packages/flutter_tools/test/commands.shard/permeable/script_test.dart
0 → 100644
View file @
45e212e7
// 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
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment