Skip to content

Commit 24ac24d

Browse files
authored
Merge pull request #39 from softprops/portable-home
homedir is a builtin
2 parents 6a8b558 + 82ea7fc commit 24ac24d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- fix a `npx serverless invoke local` for versions of serverless framework `1.40.*` which now emit `package` events as within `invokeLocal` events.
44
- bump [lambda-rust](https://hub.docker.com/r/softprops/lambda-rust/) docker version to 0.2.1-rust-1.34.1 to gain [new rust 1.34.1 features](https://blog.rust-lang.org/2019/04/25/Rust-1.34.1.html).
5+
- use `os.homedir()` instead of `process.env['HOME']` for improved portability
56

67
# ⚡ 0.3.3
78

index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// https://github.com/softprops/lambda-rust/
66

77
const { spawnSync } = require("child_process");
8+
const { homedir } = require("os");
89
const path = require("path");
910

1011
const DEFAULT_DOCKER_TAG = "0.2.1-rust-1.34.1";
@@ -50,14 +51,15 @@ class RustPlugin {
5051
}
5152

5253
runDocker(funcArgs, cargoPackage, binary) {
54+
const home = homedir();
5355
const defaultArgs = [
5456
'run',
5557
'--rm',
5658
'-t',
5759
'-e', `BIN=${binary}`,
5860
`-v`, `${this.servicePath}:/code`,
59-
`-v`, `${process.env['HOME']}/.cargo/registry:/root/.cargo/registry`,
60-
`-v`, `${process.env['HOME']}/.cargo/git:/root/.cargo/git`,
61+
`-v`, `${home}/.cargo/registry:/root/.cargo/registry`,
62+
`-v`, `${home}/.cargo/git:/root/.cargo/git`,
6163
];
6264
const customArgs = [];
6365
let cargoFlags = (funcArgs || {}).cargoFlags || this.custom.cargoFlags;

0 commit comments

Comments
 (0)