Skip to content

Commit

Permalink
Add f command
Browse files Browse the repository at this point in the history
  • Loading branch information
ly0va committed Oct 30, 2020
1 parent 60421ac commit a9e2016
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bin/zk
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ cd $ZKSYNC_HOME/infrastructure/zk
if [ -z "$1" ]; then
yarn && yarn build
else
yarn --silent start $@
yarn --silent start "$@"
fi
14 changes: 14 additions & 0 deletions infrastructure/zk/src/f.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Command } from 'commander';
import { spawnSync } from 'child_process';

export const command = new Command('f')
.arguments('<command...>')
.allowUnknownOption()
.action((command: string[]) => {
const result = spawnSync(command[0], command.slice(1), { stdio: 'inherit' });
if (result.error) {
throw result.error;
}
process.exitCode = result.status || undefined;
});

2 changes: 2 additions & 0 deletions infrastructure/zk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { command as run } from './run/run';
import { command as test } from './test/test';
import { command as docker } from './docker';
import { command as completion } from './completion';
import { command as f } from './f';
import * as env from './env';

async function main() {
Expand Down Expand Up @@ -43,6 +44,7 @@ async function main() {
.addCommand(run)
.addCommand(test)
.addCommand(docker)
.addCommand(f)
.addCommand(env.command)
.addCommand(completion(program as Command));

Expand Down
4 changes: 2 additions & 2 deletions infrastructure/zk/src/run/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ command
.command('loadtest [options...]')
.description('run the loadtest')
.allowUnknownOption()
.action(async (...options: string[]) => {
await loadtest(...options[0]);
.action(async (options: string[]) => {
await loadtest(...options);
});
4 changes: 2 additions & 2 deletions infrastructure/zk/src/test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ command
.command('circuit [threads] [test_name] [options...]')
.description('run unit-tests for the circuit')
.allowUnknownOption()
.action(async (threads: number | null, testName: string | null, ...options: string[]) => {
await circuit(threads || 1, testName || '', ...options[0]);
.action(async (threads: number | null, testName: string | null, options: string[]) => {
await circuit(threads || 1, testName || '', ...options);
});

0 comments on commit a9e2016

Please sign in to comment.