refactor: refork tail module
This commit is contained in:
+5
-14
@@ -1,9 +1,8 @@
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
import through from "through2";
|
||||
import { Env } from "../common/env";
|
||||
import { System } from "../common/system";
|
||||
import { TailVinyl } from "../common/tail";
|
||||
import { watch } from "../common/watch";
|
||||
import run from "../run";
|
||||
import { FlashPlayer } from "./flashplayer";
|
||||
|
||||
@@ -55,18 +54,10 @@ export class RufflePlayer extends FlashPlayer {
|
||||
return run(`${this.flashPlayerBin} ${filename}`, params)
|
||||
.exec()
|
||||
.pipe(
|
||||
through.obj(function (file: any, enc: string, callback: any) {
|
||||
const log = new TailVinyl({
|
||||
path: RufflePlayer.log,
|
||||
handler: (line: string) => {
|
||||
if (line.includes("avm_trace")) {
|
||||
return line.split("avm_trace: ").pop();
|
||||
}
|
||||
},
|
||||
});
|
||||
this.on("end", () => log.dispose());
|
||||
this.push(log);
|
||||
callback();
|
||||
watch(RufflePlayer.log, (line: string) => {
|
||||
if (line.includes("avm_trace")) {
|
||||
return line.split("avm_trace: ").pop();
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user