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
9fe55670
Unverified
Commit
9fe55670
authored
Feb 17, 2023
by
Jenn Magder
Committed by
GitHub
Feb 17, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Print sub process that failed to run in tool (#120999)
parent
f7851368
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
16 deletions
+31
-16
error_handling_io.dart
packages/flutter_tools/lib/src/base/error_handling_io.dart
+17
-6
error_handling_io_test.dart
...tools/test/general.shard/base/error_handling_io_test.dart
+14
-10
No files found.
packages/flutter_tools/lib/src/base/error_handling_io.dart
View file @
9fe55670
...
...
@@ -667,7 +667,10 @@ class ErrorHandlingProcessManager extends ProcessManager {
stdoutEncoding:
stdoutEncoding
,
stderrEncoding:
stderrEncoding
,
);
},
platform:
_platform
);
},
platform:
_platform
,
failureMessage:
'Flutter failed to run "
${command.join(' ')}
"'
,
);
}
@override
...
...
@@ -688,7 +691,10 @@ class ErrorHandlingProcessManager extends ProcessManager {
runInShell:
runInShell
,
mode:
mode
,
);
},
platform:
_platform
);
},
platform:
_platform
,
failureMessage:
'Flutter failed to run "
${command.join(' ')}
"'
,
);
}
@override
...
...
@@ -711,7 +717,10 @@ class ErrorHandlingProcessManager extends ProcessManager {
stdoutEncoding:
stdoutEncoding
,
stderrEncoding:
stderrEncoding
,
);
},
platform:
_platform
);
},
platform:
_platform
,
failureMessage:
'Flutter failed to run "
${command.join(' ')}
"'
,
);
}
}
...
...
@@ -759,9 +768,11 @@ void _handleMacOSException(Exception e, String? message, int errorCode, String?
const
int
ebadarch
=
86
;
if
(
errorCode
==
ebadarch
)
{
final
StringBuffer
errorBuffer
=
StringBuffer
();
errorBuffer
.
writeln
(
message
);
errorBuffer
.
writeln
(
'This binary was built with the incorrect architecture to run on this machine.'
);
errorBuffer
.
writeln
(
'Flutter requires the Rosetta translation environment. If you are on an ARM Mac, try running:'
);
if
(
message
!=
null
)
{
errorBuffer
.
writeln
(
'
$message
.'
);
}
errorBuffer
.
writeln
(
'The binary was built with the incorrect architecture to run on this machine.'
);
errorBuffer
.
writeln
(
'If you are on an ARM Apple Silicon Mac, Flutter requires the Rosetta translation environment. Try running:'
);
errorBuffer
.
writeln
(
' sudo softwareupdate --install-rosetta --agree-to-license'
);
_throwFileSystemException
(
errorBuffer
.
toString
());
}
...
...
packages/flutter_tools/test/general.shard/base/error_handling_io_test.dart
View file @
9fe55670
...
...
@@ -963,7 +963,8 @@ void main() {
platform:
windowsPlatform
,
);
const
String
expectedMessage
=
'The flutter tool cannot access the file'
;
const
String
expectedMessage
=
'Flutter failed to run "foo". The flutter tool cannot access the file or directory.
\n
'
'Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user.'
;
expect
(()
async
=>
processManager
.
start
(<
String
>[
'foo'
]),
throwsToolExit
(
message:
expectedMessage
));
expect
(()
async
=>
processManager
.
run
(<
String
>[
'foo'
]),
...
...
@@ -1021,7 +1022,8 @@ void main() {
platform:
linuxPlatform
,
);
const
String
expectedMessage
=
'The flutter tool cannot access the file'
;
const
String
expectedMessage
=
'Flutter failed to run "foo".
\n
'
'Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user.'
;
expect
(()
async
=>
processManager
.
start
(<
String
>[
'foo'
]),
throwsToolExit
(
message:
expectedMessage
));
...
...
@@ -1085,7 +1087,8 @@ void main() {
platform:
macOSPlatform
,
);
const
String
expectedMessage
=
'The flutter tool cannot access the file'
;
const
String
expectedMessage
=
'Flutter failed to run "foo".
\n
'
'Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user.'
;
expect
(()
async
=>
processManager
.
start
(<
String
>[
'foo'
]),
throwsToolExit
(
message:
expectedMessage
));
...
...
@@ -1113,9 +1116,9 @@ void main() {
testWithoutContext
(
'when bad CPU type'
,
()
async
{
final
FakeProcessManager
fakeProcessManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
'foo'
],
exception:
ProcessException
(
''
,
<
String
>[],
''
,
ebadarch
)),
const
FakeCommand
(
command:
<
String
>[
'foo'
],
exception:
ProcessException
(
''
,
<
String
>[],
''
,
ebadarch
)),
const
FakeCommand
(
command:
<
String
>[
'foo'
],
exception:
ProcessException
(
''
,
<
String
>[],
''
,
ebadarch
)),
const
FakeCommand
(
command:
<
String
>[
'foo'
,
'--bar'
],
exception:
ProcessException
(
''
,
<
String
>[],
''
,
ebadarch
)),
const
FakeCommand
(
command:
<
String
>[
'foo'
,
'--bar'
],
exception:
ProcessException
(
''
,
<
String
>[],
''
,
ebadarch
)),
const
FakeCommand
(
command:
<
String
>[
'foo'
,
'--bar'
],
exception:
ProcessException
(
''
,
<
String
>[],
''
,
ebadarch
)),
]);
final
ProcessManager
processManager
=
ErrorHandlingProcessManager
(
...
...
@@ -1123,13 +1126,14 @@ void main() {
platform:
macOSPlatform
,
);
const
String
expectedMessage
=
'Flutter requires the Rosetta translation environment'
;
const
String
expectedMessage
=
'Flutter failed to run "foo --bar".
\n
'
'The binary was built with the incorrect architecture to run on this machine.'
;
expect
(()
async
=>
processManager
.
start
(<
String
>[
'foo'
]),
expect
(()
async
=>
processManager
.
start
(<
String
>[
'foo'
,
'--bar'
]),
throwsToolExit
(
message:
expectedMessage
));
expect
(()
async
=>
processManager
.
run
(<
String
>[
'foo'
]),
expect
(()
async
=>
processManager
.
run
(<
String
>[
'foo'
,
'--bar'
]),
throwsToolExit
(
message:
expectedMessage
));
expect
(()
=>
processManager
.
runSync
(<
String
>[
'foo'
]),
expect
(()
=>
processManager
.
runSync
(<
String
>[
'foo'
,
'--bar'
]),
throwsToolExit
(
message:
expectedMessage
));
});
});
...
...
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