core: allow --legacy

This commit is contained in:
undefined committed 2021-01-03 18:01:45 +08:00
1 parent c89ef43a88
commit ea19d7997e
2 files changed
+5 -4

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "2.15.8", "version": "2.15.9",
"bin": "bin/hydrooj.js", "bin": "bin/hydrooj.js",
"main": "dist/loader.js", "main": "dist/loader.js",
"typings": "dist/loader.d.ts", "typings": "dist/loader.d.ts",
+4 -3
View File
@@ -4,6 +4,7 @@ import cluster from 'cluster';
import { import {
terminal, TextBox, LabeledInput, terminal, TextBox, LabeledInput,
} from 'terminal-kit'; } from 'terminal-kit';
import { argv } from 'yargs';
import * as bus from './service/bus'; import * as bus from './service/bus';
declare module 'terminal-kit/Terminal' { declare module 'terminal-kit/Terminal' {
@@ -30,7 +31,7 @@ export namespace Progress {
} }
export function create(args) { export function create(args) {
return process.stdout.isTTY return (process.stdout.isTTY && !argv.legacy)
? terminal.progressBar(args) ? terminal.progressBar(args)
: new Progress(args); : new Progress(args);
} }
@@ -43,7 +44,7 @@ async function terminate() {
} catch (e) { } catch (e) {
hasError = true; hasError = true;
} }
if (cluster.isMaster && process.stdout.isTTY) { if (cluster.isMaster && process.stdout.isTTY && !argv.legacy) {
terminal.hideCursor(false); terminal.hideCursor(false);
terminal.styleReset(); terminal.styleReset();
terminal.resetScrollingRegion(); terminal.resetScrollingRegion();
@@ -54,7 +55,7 @@ async function terminate() {
} }
process.on('SIGINT', terminate); process.on('SIGINT', terminate);
if (cluster.isMaster && process.stdout.isTTY) { if (cluster.isMaster && process.stdout.isTTY && !argv.legacy) {
terminal.clear(); terminal.clear();
terminal.grabInput(); terminal.grabInput();
terminal.hideCursor(); terminal.hideCursor();