Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Set exitcode to 0 on successful uwptool launch #26105

Merged
merged 1 commit into from
May 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions shell/platform/windows/uwptool_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@ void PrintInstalledApps() {
// returned.
int LaunchApp(const std::wstring_view app_id, const std::wstring_view args) {
flutter::Application app(app_id);
DWORD process_id = app.Launch(args);
if (process_id == -1) {
std::wcerr << L"Failed to launch app " << app.GetPackageId() << std::endl;
return 1;
}
return 0;
return app.Launch(args);
}

// Prints the command usage to stderr.
Expand Down Expand Up @@ -82,8 +77,20 @@ int main(int argc, char** argv) {
app_args << " ";
}
}
return LaunchApp(flutter::Utf16FromUtf8(package_id),
flutter::Utf16FromUtf8(app_args.str()));
int process_id = LaunchApp(flutter::Utf16FromUtf8(package_id),
flutter::Utf16FromUtf8(app_args.str()));
if (process_id == -1) {
std::cerr << "error: Failed to launch app with package ID " << package_id
<< std::endl;
return 1;
}

// Write an informative message for the user to stderr.
std::cerr << "Launched app with package_id " << package_id
<< ". PID: " << std::endl;
// Write the PID to stdout. The flutter tool reads this value in.
std::cout << process_id << std::endl;
return 0;
}

std::cerr << "Unknown command: " << command << std::endl;
Expand Down
2 changes: 2 additions & 0 deletions shell/platform/windows/uwptool_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class Application {
std::wstring GetPackageId() const { return package_id_; }

// Launches the application with the specified list of launch arguments.
//
// Returns the process ID on success, or -1 on failure.
int Launch(const std::wstring_view args);

private:
Expand Down