diff --git a/bench.js b/bench.js index ddbf20c..7410dd1 100644 --- a/bench.js +++ b/bench.js @@ -52,7 +52,7 @@ const prepareBranch = async function ( const repositoryPath = path.join(gitDirectory, repo) var { url } = await getPushDomain() - await runner.run( + runner.run( `mkdir -p ${gitDirectory}; git clone ${url}/${owner}/${repo} ${repositoryPath}`, ) @@ -62,36 +62,36 @@ const prepareBranch = async function ( return errorResult(`Failed to enter directory ${repositoryPath}`, error) } - var { error, stderr } = await runner.run("git add . && git reset --hard HEAD") + var { error, stderr } = runner.run("git add . && git reset --hard HEAD") if (error) return errorResult(stderr) - var { error, stdout, stderr } = await runner.run("git rev-parse HEAD") + var { error, stdout, stderr } = runner.run("git rev-parse HEAD") if (error) return errorResult(stderr) const detachedHead = stdout.trim() // Check out to the detached head so that any branch can be deleted - var { error, stderr } = await runner.run(`git checkout ${detachedHead}`) + var { error, stderr } = runner.run(`git checkout ${detachedHead}`) if (error) return errorResult(stderr) // Recreate PR remote - await runner.run("git remote remove pr") + runner.run("git remote remove pr") var { url } = await getPushDomain() - var { error, stderr } = await runner.run( + var { error, stderr } = runner.run( `git remote add pr ${url}/${contributor}/${repo}.git`, ) if (error) return errorResult(`Failed to add remote reference to ${owner}/${repo}`) // Fetch and recreate the PR's branch - await runner.run(`git branch -D ${branch}`) - var { error, stderr } = await runner.run( + runner.run(`git branch -D ${branch}`) + var { error, stderr } = runner.run( `git fetch pr ${branch} && git checkout --track pr/${branch}`, `Checking out ${branch}...`, ) if (error) return errorResult(stderr) // Fetch and merge master - var { error, stderr } = await runner.run( + var { error, stderr } = runner.run( `git pull origin ${baseBranch}`, `Merging branch ${baseBranch}`, ) @@ -120,7 +120,7 @@ function benchBranch(runner, config) { var error = await prepareBranch(config, { runner }) if (error) return error - var { stderr, error, stdout } = await runner.run( + var { stderr, error, stdout } = runner.run( benchCommand, `Benching branch ${config.branch}...`, ) @@ -450,7 +450,7 @@ function benchmarkRuntime(runner, config) { if (error) return error const outputFile = benchCommand.match(/--output(?:=|\s+)(".+?"|\S+)/)[1] - var { stdout, stderr, error } = await runner.run( + var { stdout, stderr, error } = runner.run( benchCommand, `Running for branch ${config.branch}, ${ outputFile ? `outputFile: ${outputFile}` : "" @@ -462,7 +462,7 @@ function benchmarkRuntime(runner, config) { let extraInfo = "" - var { stdout: gitStatus, stderr: gitStatusError } = await runner.run( + var { stdout: gitStatus, stderr: gitStatusError } = runner.run( "git status --short", ) runner.log(`Git status after execution: ${gitStatus || gitStatusError}`) @@ -475,7 +475,7 @@ function benchmarkRuntime(runner, config) { }) } else { try { - var last = await runner.run( + var last = runner.run( `git add ${outputFile} && git commit -m "${benchCommand}"`, ) if (last.error) { @@ -487,7 +487,7 @@ function benchmarkRuntime(runner, config) { } else { const target = `${config.contributor}/${config.repo}` const { url, token } = await config.getPushDomain() - var last = await runner.run( + var last = runner.run( `git remote set-url pr ${url}/${target}.git && git push pr HEAD`, `Pushing ${outputFile} to ${config.branch}`, ) diff --git a/index.js b/index.js index 2c365fa..36d4366 100644 --- a/index.js +++ b/index.js @@ -111,7 +111,7 @@ module.exports = (app) => { stdout: toolchain, error, stderr, - } = await runner.run("rustup show active-toolchain --verbose") + } = runner.run("rustup show active-toolchain --verbose") if (error) { const msg = "ERROR: Failed to query the currently active Rust toolchain" if (process.env.DEBUG) { diff --git a/runner.js b/runner.js index 54c9cf0..bf54881 100644 --- a/runner.js +++ b/runner.js @@ -18,7 +18,7 @@ class Runner { this.log = app.log } - async run(cmd, title) { + run(cmd, title) { let stdout = "", stderr = "", error = false @@ -28,8 +28,6 @@ class Runner { this.log({ title, msg: `Running task on directory ${process.cwd()}` }) } - await writeFileAsync(runnerOutput, "") - // The command is ran asynchronously so that the bot can still handle // requests while it's busy running some benchmark. Previously we favored // running the command synchronously so that there was less risk of having @@ -49,16 +47,6 @@ class Runner { stdout = result.stdout } catch (err) { error = true - try { - if (await existsAsync(runnerOutput)) { - stderr = (await readFileAsync(runnerOutput)).toString() - } - } catch (stderrReadError) { - this.logFatalError( - stderrReadError, - "Failed to read stderr from command", - ) - } this.logFatalError(err, "Caught exception in command execution") }