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
e524a303
Unverified
Commit
e524a303
authored
Apr 27, 2020
by
Emmanuel Garcia
Committed by
GitHub
Apr 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Print stdout and stderr when the ssh command failed (#55762)
parent
069dc9c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
1 deletion
+48
-1
fuchsia_device.dart
packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
+5
-1
fuchsia_device_test.dart
...tools/test/general.shard/fuchsia/fuchsia_device_test.dart
+43
-0
No files found.
packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
View file @
e524a303
...
@@ -802,7 +802,11 @@ class _FuchsiaPortForwarder extends DevicePortForwarder {
...
@@ -802,7 +802,11 @@ class _FuchsiaPortForwarder extends DevicePortForwarder {
];
];
final
ProcessResult
result
=
await
globals
.
processManager
.
run
(
command
);
final
ProcessResult
result
=
await
globals
.
processManager
.
run
(
command
);
if
(
result
.
exitCode
!=
0
)
{
if
(
result
.
exitCode
!=
0
)
{
throwToolExit
(
'Unforward command failed:
$result
'
);
throwToolExit
(
'Unforward command failed:
\n
'
'stdout:
${result.stdout}
\n
'
'stderr:
${result.stderr}
'
);
}
}
}
}
...
...
packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart
View file @
e524a303
...
@@ -563,6 +563,49 @@ void main() {
...
@@ -563,6 +563,49 @@ void main() {
},
testOn:
'posix'
);
},
testOn:
'posix'
);
});
});
group
(
'portForwarder'
,
()
{
MockProcessManager
mockProcessManager
;
MockFile
sshConfig
;
setUp
(()
{
mockProcessManager
=
MockProcessManager
();
sshConfig
=
MockFile
();
when
(
sshConfig
.
path
).
thenReturn
(
'irrelevant'
);
when
(
sshConfig
.
existsSync
()).
thenReturn
(
true
);
when
(
sshConfig
.
absolute
).
thenReturn
(
sshConfig
);
});
testUsingContext
(
'`unforward` prints stdout and stderr if ssh command failed'
,
()
async
{
final
FuchsiaDevice
device
=
FuchsiaDevice
(
'id'
,
name:
'tester'
);
final
MockProcessResult
mockFailureProcessResult
=
MockProcessResult
();
when
(
mockFailureProcessResult
.
exitCode
).
thenReturn
(
1
);
when
<
String
>(
mockFailureProcessResult
.
stdout
as
String
).
thenReturn
(
'<stdout>'
);
when
<
String
>(
mockFailureProcessResult
.
stderr
as
String
).
thenReturn
(
'<stderr>'
);
when
(
mockProcessManager
.
run
(<
String
>[
'ssh'
,
'-F'
,
'irrelevant'
,
'-O'
,
'cancel'
,
'-vvv'
,
'-L'
,
'0:127.0.0.1:1'
,
'id'
,
])).
thenAnswer
((
Invocation
invocation
)
{
return
Future
<
ProcessResult
>.
value
(
mockFailureProcessResult
);
});
await
expectLater
(
()
=>
device
.
portForwarder
.
unforward
(
ForwardedPort
(
/*hostPort=*/
0
,
/*devicePort=*/
1
)),
throwsToolExit
(
message:
'Unforward command failed:
\n
stdout: <stdout>
\n
stderr: <stderr>'
),
);
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
FuchsiaArtifacts:
()
=>
FuchsiaArtifacts
(
sshConfig:
sshConfig
),
});
});
group
(
FuchsiaIsolateDiscoveryProtocol
,
()
{
group
(
FuchsiaIsolateDiscoveryProtocol
,
()
{
MockPortForwarder
portForwarder
;
MockPortForwarder
portForwarder
;
...
...
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