Skip to content

Commit

Permalink
fix(core): prevent snapshot commands from running if core is running (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
faustbrian authored and spkjp committed Nov 4, 2019
1 parent f284b4b commit 1b3c5b6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/core/src/commands/snapshot/dump.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export class DumpCommand extends BaseCommand {
public async run(): Promise<void> {
const { flags, paths } = await this.parseWithNetwork(DumpCommand);

this.abortRunningProcess(`${flags.token}-core`);
this.abortRunningProcess(`${flags.token}-forger`);
this.abortRunningProcess(`${flags.token}-relay`);

await setUpLite(flags, paths);

if (!app.has("snapshots")) {
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/commands/snapshot/restore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export class RestoreCommand extends BaseCommand {
public async run(): Promise<void> {
const { flags, paths } = await this.parseWithNetwork(RestoreCommand);

this.abortRunningProcess(`${flags.token}-core`);
this.abortRunningProcess(`${flags.token}-forger`);
this.abortRunningProcess(`${flags.token}-relay`);

await setUpLite(flags, paths);

if (!app.has("snapshots")) {
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/commands/snapshot/rollback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export class RollbackCommand extends BaseCommand {
public async run(): Promise<void> {
const { flags, paths } = await this.parseWithNetwork(RollbackCommand);

this.abortRunningProcess(`${flags.token}-core`);
this.abortRunningProcess(`${flags.token}-forger`);
this.abortRunningProcess(`${flags.token}-relay`);

await setUpLite(flags, paths);

if (!app.has("snapshots")) {
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/commands/snapshot/truncate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export class TruncateCommand extends BaseCommand {
public async run(): Promise<void> {
const { flags, paths } = await this.parseWithNetwork(TruncateCommand);

this.abortRunningProcess(`${flags.token}-core`);
this.abortRunningProcess(`${flags.token}-forger`);
this.abortRunningProcess(`${flags.token}-relay`);

await setUpLite(flags, paths);

if (!app.has("snapshots")) {
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/commands/snapshot/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export class VerifyCommand extends BaseCommand {
public async run(): Promise<void> {
const { flags, paths } = await this.parseWithNetwork(VerifyCommand);

this.abortRunningProcess(`${flags.token}-core`);
this.abortRunningProcess(`${flags.token}-forger`);
this.abortRunningProcess(`${flags.token}-relay`);

await setUpLite(flags, paths);

if (!app.has("snapshots")) {
Expand Down

0 comments on commit 1b3c5b6

Please sign in to comment.