mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-06-19 08:18:07 +00:00
Add better semantics for detached mode + live for push
Now if you pass both --live and --detached, the logs won't be displayed but livepush will continue to run. Change-type: patch Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
@ -149,16 +149,6 @@ export async function deployToDevice(opts: DeviceDeployOptions): Promise<void> {
|
|||||||
|
|
||||||
await api.setTargetState(targetState);
|
await api.setTargetState(targetState);
|
||||||
|
|
||||||
if (opts.detached) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Print an empty newline to separate the build output
|
|
||||||
// from the device output
|
|
||||||
console.log();
|
|
||||||
globalLogger.logInfo('Streaming device logs...');
|
|
||||||
// Now all we need to do is stream back the logs
|
|
||||||
const logStream = await api.getLogStream();
|
|
||||||
|
|
||||||
// Now that we've set the target state, the device will do it's thing
|
// Now that we've set the target state, the device will do it's thing
|
||||||
// so we can either just display the logs, or start a livepush session
|
// so we can either just display the logs, or start a livepush session
|
||||||
// (whilst also display logs)
|
// (whilst also display logs)
|
||||||
@ -175,11 +165,27 @@ export async function deployToDevice(opts: DeviceDeployOptions): Promise<void> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
globalLogger.logLivepush('Watching for file changes...');
|
globalLogger.logLivepush('Watching for file changes...');
|
||||||
await Promise.all([
|
const promises = [livepush.init()];
|
||||||
livepush.init(),
|
// Only show logs if we're not detaching
|
||||||
displayDeviceLogs(logStream, globalLogger, opts.system, opts.service),
|
if (!opts.detached) {
|
||||||
]);
|
console.log();
|
||||||
|
const logStream = await api.getLogStream();
|
||||||
|
globalLogger.logInfo('Streaming device logs...');
|
||||||
|
promises.push(
|
||||||
|
displayDeviceLogs(logStream, globalLogger, opts.system, opts.service),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
await Promise.all(promises);
|
||||||
} else {
|
} else {
|
||||||
|
if (opts.detached) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Print an empty newline to separate the build output
|
||||||
|
// from the device output
|
||||||
|
console.log();
|
||||||
|
// Now all we need to do is stream back the logs
|
||||||
|
const logStream = await api.getLogStream();
|
||||||
|
globalLogger.logInfo('Streaming device logs...');
|
||||||
await displayDeviceLogs(logStream, globalLogger, opts.system, opts.service);
|
await displayDeviceLogs(logStream, globalLogger, opts.system, opts.service);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user