Trim logging and encode stdout/stderr

This commit is contained in:
Ana Hobden 2023-07-12 11:09:28 -07:00
parent 3bae1cc12f
commit 35759c8458
3 changed files with 17 additions and 9 deletions

12
dist/index.js vendored
View file

@ -191,11 +191,13 @@ class NixInstallerAction {
const spawned = (0, node_child_process_1.spawn)(`${binary_path}`, args, { const spawned = (0, node_child_process_1.spawn)(`${binary_path}`, args, {
env: merged_env env: merged_env
}); });
spawned.stdout.setEncoding('utf-8');
spawned.stdout.on('data', data => { spawned.stdout.on('data', data => {
actions_core.info(data); actions_core.info(data.trim());
}); });
spawned.stderr.setEncoding('utf-8');
spawned.stderr.on('data', data => { spawned.stderr.on('data', data => {
actions_core.info(data); actions_core.info(data.trim());
}); });
const exit_code = yield new Promise((resolve, _reject) => { const exit_code = yield new Promise((resolve, _reject) => {
spawned.on('close', resolve); spawned.on('close', resolve);
@ -238,11 +240,13 @@ class NixInstallerAction {
env: Object.assign({ NIX_INSTALLER_NO_CONFIRM: 'true' }, process.env // To get $PATH, etc env: Object.assign({ NIX_INSTALLER_NO_CONFIRM: 'true' }, process.env // To get $PATH, etc
) )
}); });
spawned.stdout.setEncoding('utf-8');
spawned.stdout.on('data', data => { spawned.stdout.on('data', data => {
actions_core.info(data); actions_core.info(data.trim());
}); });
spawned.stderr.setEncoding('utf-8');
spawned.stderr.on('data', data => { spawned.stderr.on('data', data => {
actions_core.info(data); actions_core.info(data.trim());
}); });
const exit_code = yield new Promise((resolve, _reject) => { const exit_code = yield new Promise((resolve, _reject) => {
spawned.on('close', resolve); spawned.on('close', resolve);

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View file

@ -218,12 +218,14 @@ class NixInstallerAction {
env: merged_env env: merged_env
}) })
spawned.stdout.setEncoding('utf-8')
spawned.stdout.on('data', data => { spawned.stdout.on('data', data => {
actions_core.info(data) actions_core.info(data.trim())
}) })
spawned.stderr.setEncoding('utf-8')
spawned.stderr.on('data', data => { spawned.stderr.on('data', data => {
actions_core.info(data) actions_core.info(data.trim())
}) })
const exit_code: number = await new Promise((resolve, _reject) => { const exit_code: number = await new Promise((resolve, _reject) => {
@ -272,12 +274,14 @@ class NixInstallerAction {
} }
}) })
spawned.stdout.setEncoding('utf-8')
spawned.stdout.on('data', data => { spawned.stdout.on('data', data => {
actions_core.info(data) actions_core.info(data.trim())
}) })
spawned.stderr.setEncoding('utf-8')
spawned.stderr.on('data', data => { spawned.stderr.on('data', data => {
actions_core.info(data) actions_core.info(data.trim())
}) })
const exit_code: number = await new Promise((resolve, _reject) => { const exit_code: number = await new Promise((resolve, _reject) => {