Skip to content

Commit

Permalink
fixed logging stdout and stderr to file
Browse files Browse the repository at this point in the history
  • Loading branch information
reedHam committed May 13, 2022
1 parent 89a882e commit fb00dbe
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,13 @@ export async function runExecFile(
container: Container,
cmd: string,
file: string,
directory = "/"
directory = "/",
options?: {
append: boolean;
}
) {
const filePath = path.join(directory, file);
const cmdWithFile = ["sh", "-c", `${cmd} 2>&1 > ${filePath}`];
const cmdWithFile = ["sh", "-c", `${cmd} ${options?.append ? '>>' : '>'} ${filePath} 2>&1`];
const execProcess = await container.exec({
Cmd: cmdWithFile,
AttachStdout: false,
Expand Down

0 comments on commit fb00dbe

Please sign in to comment.