fix: default parameter for exec cmd
- change: from bypass to block. Signed-off-by: pakintada@gmail.com <Pakin>
This commit is contained in:
parent
54a5813d06
commit
fbbf0c12f4
4 changed files with 28 additions and 69 deletions
|
|
@ -396,8 +396,8 @@ function sanitizeAdbCommand(command: string): string {
|
|||
return command;
|
||||
}
|
||||
|
||||
export async function executeCmd(command: string, { bypass = false }) {
|
||||
command = !bypass ? sanitizeAdbCommand(command) : command;
|
||||
export async function executeCmd(command: string, block: boolean = false) {
|
||||
command = block ? sanitizeAdbCommand(command) : command;
|
||||
let instance = getAdbInstance();
|
||||
|
||||
if (!instance) {
|
||||
|
|
@ -448,7 +448,7 @@ export async function executeCmd(command: string, { bypass = false }) {
|
|||
export async function goToMachineHome() {
|
||||
if (!getAdbInstance()) return;
|
||||
try {
|
||||
await executeCmd('input keyevent KEYCODE_HOME', { bypass: true });
|
||||
await executeCmd('input keyevent KEYCODE_HOME');
|
||||
} catch (e) {
|
||||
console.error('[goToMachineHome] error', e);
|
||||
}
|
||||
|
|
@ -700,14 +700,7 @@ async function connectToAndroidServer(maxRetries = 5) {
|
|||
handleAdbPayload(new TextDecoder().decode(raw));
|
||||
}
|
||||
};
|
||||
|
||||
// logger.info("prep post ");
|
||||
// worker.postMessage({ stream }, [stream]);
|
||||
}
|
||||
|
||||
// const reader = stream.readable.getReader();
|
||||
|
||||
// logger.info('checking on writer ', writer);
|
||||
adbWriter.set(writer);
|
||||
|
||||
if (writer) {
|
||||
|
|
@ -723,45 +716,6 @@ async function connectToAndroidServer(maxRetries = 5) {
|
|||
(worker as any).postMessage({ type: 'CHUNK', payload: value }, [value.buffer]);
|
||||
}
|
||||
})();
|
||||
|
||||
// const textDecoder = new TextDecoder();
|
||||
// let buffer = '';
|
||||
|
||||
// (async () => {
|
||||
// try {
|
||||
// while (true) {
|
||||
// const { value, done } = await reader.read();
|
||||
// if (done) break;
|
||||
|
||||
// // decode chunk
|
||||
// buffer += textDecoder.decode(value, { stream: true });
|
||||
|
||||
// let lines = buffer.split('\n');
|
||||
|
||||
// // save potential incomplete
|
||||
// buffer = lines.pop() ?? '';
|
||||
|
||||
// for (const line of lines) {
|
||||
// if (line.trim() === '') continue;
|
||||
|
||||
// GlobalEventBus.emit('adb:raw-payload', line);
|
||||
// handleAdbPayload(line);
|
||||
// }
|
||||
|
||||
// // GlobalEventBus.emit('adb:raw-payload', new TextDecoder().decode(value));
|
||||
// // handleAdbPayload(new TextDecoder().decode(value));
|
||||
// }
|
||||
// } catch (e) {
|
||||
// logger.error('read error', e);
|
||||
// if (isRecoverableError(e)) {
|
||||
// void connectToAndroidServer();
|
||||
// }
|
||||
// } finally {
|
||||
// adbWriter.set(null);
|
||||
// addNotification('WARN:Brewing Mode T Offline ...');
|
||||
// reader.cancel().catch(() => {});
|
||||
// }
|
||||
// })();
|
||||
return;
|
||||
} else {
|
||||
addNotification('WARN:Brewing Mode T unavailable');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue