Skip to content

Commit

Permalink
patch: Add append flags to Serial Capture file
Browse files Browse the repository at this point in the history
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
  • Loading branch information
vipulgupta2048 authored and klutchell committed Jul 13, 2022
1 parent 5253727 commit 01f34dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/workers/testbot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import * as Stream from 'stream';
import { manageHandlers } from '../helpers';
import ScreenCapture from '../helpers/graphics';
import NetworkManager, { Supported } from '../helpers/nm';
import once from 'lodash/once';


// TODO: Consider moving network and screen capture logic to testbot SDK.

Expand Down Expand Up @@ -116,8 +118,12 @@ class TestBotWorker extends EventEmitter implements Leviathan.Worker {
public async powerOn() {
const dutLog = await this.hatBoard.openDutSerial();
if (dutLog) {
this.dutLogStream = createWriteStream(dutSerialPath);
this.dutLogStream = createWriteStream(dutSerialPath, { flags: `a+` });
dutLog.pipe(this.dutLogStream);
} else {
once(() => {
console.error(`Can't record serial logs: Getting ${dutLog} output`)
})
}
console.log('Trying to power on DUT...');
await this.deviceInteractor.powerOn();
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"scripts": {
"lint:fix": "balena-lint -e js -e ts --fix bin/ lib/ test/",
"lint": "balena-lint -u -e js -e ts --tests lib/ bin/ test/ && tsc --noEmit",
"preinstall": "for component in 'worker'; do npm --prefix $component install; done",
"clean": "rm -rf build",
"test": "npm run lint:fix && npm run lint && npm run test:cov",
"build": "npm run clean && tsc",
Expand Down

0 comments on commit 01f34dc

Please sign in to comment.