Skip to content

Commit

Permalink
fix: Ensure cast toString before trim on buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrzesik committed Dec 3, 2021
1 parent e3d9ebc commit f60eed1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ async function tryBindPath(bindPath, testFile, pluginInstance) {
const ps = await dockerCommand(options, pluginInstance);
if (debug) {
if (log) {
log.debug(ps.stdoutBuffer.trim());
log.debug(ps.stdoutBuffer.toString().trim());
} else {
serverless.cli.log(ps.stdoutBuffer.trim());
serverless.cli.log(ps.stdoutBuffer.toString().trim());
}
}
return ps.stdoutBuffer.trim() === `/test/${testFile}`;
return ps.stdoutBuffer.toString().trim() === `/test/${testFile}`;
} catch (err) {
if (debug) {
if (log) {
Expand Down Expand Up @@ -197,7 +197,7 @@ async function getDockerUid(bindPath, pluginInstance) {
'/bin/sh',
];
const ps = await dockerCommand(options, pluginInstance);
return ps.stdoutBuffer.trim();
return ps.stdoutBuffer.toString().trim();
}

module.exports = { buildImage, getBindPath, getDockerUid };

0 comments on commit f60eed1

Please sign in to comment.