Skip to content

Commit

Permalink
Wrap spawn calls
Browse files Browse the repository at this point in the history
  • Loading branch information
eternauta1337 committed Apr 3, 2024
1 parent 21ffd3a commit ca14569
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/ethernaut-common/src/test/terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const chalk = require('chalk')
const wait = require('ethernaut-common/src/util/wait')
const { spawn } = require('child_process')
const kill = require('tree-kill')
const path = require('path')

// eslint-disable-next-line no-control-regex
const ansiEscapeCodesPattern = /\x1B\[[0-?]*[ -/]*[@-~]/g
Expand All @@ -26,9 +27,21 @@ class Terminal {
async run(command, delay = 10000, killAfter = false) {
this.output = ''

const p = path.resolve(
__dirname,
'../../../../',
'node_modules/nyc/bin/wrap.js',
)
const h = path.resolve(
__dirname,
'../../../../',
'node_modules/.bin/hardhat',
)
command = command.replace('hardhat', h)
const args = command.split(' ')
args.unshift(p)
args.concat(['&&', 'sleep', '1', '&&', 'exit'])
const f = 'npx'
const f = process.execPath
debug.log(`Running command: ${f} ${args.join(' ')}`, 'terminal')
this.process = spawn(f, args, { shell: true, stdio: 'pipe' })

Expand Down

0 comments on commit ca14569

Please sign in to comment.