Skip to content

Commit

Permalink
chore: trim final spawn result
Browse files Browse the repository at this point in the history
  • Loading branch information
ctjlewis committed May 25, 2023
1 parent 6413443 commit 72d20c8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 97 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
},
"devDependencies": {
"@tsmodule/log": "^2.2.1",
"@tsmodule/tsmodule": "^44.5.0",
"@tsmodule/tsmodule": "^44.7.0",
"@types/node": "^20.2.3",
"ava": "^5.2.0"
"ava": "^5.3.0"
},
"keywords": [
"shell",
Expand All @@ -47,4 +47,4 @@
"releaseName": "v${version}"
}
}
}
}
97 changes: 8 additions & 89 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ export const createShell = ({
childProcess = null;
const spawnResult = {
code,
stdout,
stderr,
stdout: stdout.trim(),
stderr: stderr.trim(),
};

if (code === 0) {
Expand Down
5 changes: 2 additions & 3 deletions test/errors.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { URL, fileURLToPath } from "url";
import { EOL } from "os";
import { Platform } from "../src/types";
import { createShell } from "../src";
import test from "ava";
Expand Down Expand Up @@ -117,7 +116,7 @@ test.serial("should return proper { code, stdin, stderr } values", async (t) =>
const { code, stdout, stderr } = await shell.run("echo hello world");

t.is(code, 0);
t.is(stdout, `hello world${EOL}`);
t.is(stdout, `hello world`);
t.is(stderr, "");
});

Expand Down Expand Up @@ -162,7 +161,7 @@ test.serial("should support platform-specific overrides", async (t) => {

t.is(
stdout,
`hello ${platform}${EOL}`,
`hello ${platform}`,
`should use ${platform} command for target ${target}`
);
}
Expand Down

0 comments on commit 72d20c8

Please sign in to comment.