Skip to content

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
AtomicSponge committed Jun 7, 2024
1 parent 0305d76 commit 25d55f2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions job-runner/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class JobRunner {
this.#opts = opts || []

// error checking
if(this.#opts.length > 0 && this.#cmds.length !== this.#opts.length) {
if(this.#opts.length > 1 && this.#cmds.length !== this.#opts.length) {
throw new JobRunnerError(
`Must provide the name number of command and option arguments!`,
this.constructor
Expand All @@ -57,7 +57,8 @@ export class JobRunner {

/**
* Run the group of loaded jobs
* @returns Am object with the count of successful and failed runs
* @returns Am object with the count of successful and failed runs,
* and an array of the results
*/
jobRunner = async ():Promise<RunResults> => {
let goodRes = 0
Expand All @@ -67,7 +68,11 @@ export class JobRunner {
this.#jobPriomises.push(new AsyncResolver())
const jobIDX = this.#jobPriomises.length - 1

exec(cmd, this.#opts[jobIDX], (error:any, stdout:string, stderr:string) => {
let opt
if(this.#opts.length === 1) opt = this.#opts[0]
else opt = this.#opts[jobIDX]

exec(cmd, opt, (error:any, stdout:string, stderr:string) => {
if(error) {
const cmdRes = {
command: cmd,
Expand Down

0 comments on commit 25d55f2

Please sign in to comment.