Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Unified Diff: apps/app_host/operation_launcher.h

Issue 12674028: Report text output and exit code for command-line operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Forgotten review responses. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « apps/app_host/app_host_main.cc ('k') | apps/app_host/operation_launcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/app_host/operation_launcher.h
diff --git a/apps/app_host/operation_launcher.h b/apps/app_host/operation_launcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..d95fffe78db7d1f6f8d65899912c03d48792c8c0
--- /dev/null
+++ b/apps/app_host/operation_launcher.h
@@ -0,0 +1,53 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Operations are command-line invocations. Like a process, they can have output
+// and an exit code. But an operation does not necessarily correspond to a
+// single process. For example, the operation can complete while the launched
+// process continues to perform other tasks, or the launched process might exit
+// while the operation is completed by other processes.
+//
+// An executable implements an operation by accepting three additional arguments
+// on the command-line:
+//
+// switches::kTaskRemoteProcessId
+// The process ID of the operation client
+//
+// switches::kTaskOutputHandle
+// A writable HANDLE, valid in the client process, which should be used to
+// write the operation output.
+//
+// switches::kTaskResultHandle
+// A writable HANDLE, valid in the client process, which should be used to
+// write the operation exit code (as a binary DWORD).
+//
+// LaunchOperation (declared below) will add these parameters to the operation
+// command-line before invoking it to launch the original operation process. The
+// HANDLEs will only be valid during the lifetime of the original operation
+// process; therefore the operation implementation MUST be sure to duplicate
+// them before it exits if it is delegating to a tertiary process.
+
+#ifndef APPS_APP_HOST_OPERATION_LAUNCHER_H_
+#define APPS_APP_HOST_OPERATION_LAUNCHER_H_
+
+#include <windows.h>
+
+class CommandLine;
+
+namespace app_host {
+
+// Runs |command_line|, passing anonymous pipes to be used for operation output
+// and exit code. To prevent deadlocks, |output_write| must be drained somehow
+// (otherwise the operation may block while writing its output if the pipe's
+// buffer is full). In production code it will typically be the terminal of the
+// current process.
+// Returns true if the operation is successfully launched and its exit code
+// received.
+bool LaunchOperation(const CommandLine& command_line,
+ HANDLE output_write,
+ DWORD* exit_code);
+
+} // namespace app_host
+
+#endif // APPS_APP_HOST_OPERATION_LAUNCHER_H_
« no previous file with comments | « apps/app_host/app_host_main.cc ('k') | apps/app_host/operation_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698