init: Introduce RequiresConsole()
Prepare for adding more code in the parent process that depends on whether or not a console is required. Bug: 213617178 Change-Id: I066ede32fcd4ce09d06be23158f3c1970064a697 Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
parent
c8f34254b8
commit
987391656f
|
@ -240,7 +240,7 @@ Result<void> SetProcessAttributes(const ProcessAttributes& attr) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!attr.console.empty()) {
|
||||
if (RequiresConsole(attr)) {
|
||||
setsid();
|
||||
OpenConsole(attr.console);
|
||||
} else {
|
||||
|
|
|
@ -95,6 +95,11 @@ struct ProcessAttributes {
|
|||
int priority;
|
||||
bool stdio_to_kmsg;
|
||||
};
|
||||
|
||||
inline bool RequiresConsole(const ProcessAttributes& attr) {
|
||||
return !attr.console.empty();
|
||||
}
|
||||
|
||||
Result<void> SetProcessAttributes(const ProcessAttributes& attr);
|
||||
|
||||
Result<void> WritePidToFiles(std::vector<std::string>* files);
|
||||
|
|
Loading…
Reference in New Issue