Skip to content

Commit

Permalink
correct way to detect current executable path
Browse files Browse the repository at this point in the history
  • Loading branch information
DenKoren committed Sep 4, 2024
1 parent 0bad4b0 commit 011f905
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@milaboratory/small-binaries",
"version": "1.10.0",
"version": "1.10.1",
"description": "Small cross-platform binaries, like 'sleep' or 'hello-world', suitable for test needs",
"scripts": {
"cleanup": "rm -rf ./pkg-*.tgz && rm -rf ./build/ && rm -rf ./dist/",
Expand Down Expand Up @@ -89,7 +89,7 @@

"runenv-python-stub": {
"registry": "milaboratories" ,
"version": "1.0.0",
"version": "1.0.1",
"type": "environment",
"runtime": "python",
"roots": {
Expand Down
9 changes: 6 additions & 3 deletions runenv-python-stub.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func main() {

if isVenvCreation(os.Args) {
createFakeVenv(os.Args)
fmt.Fprintf(os.Stdout, "venv directory created")
fmt.Fprintf(os.Stdout, "venv directory created\n")
return
}
}
Expand All @@ -53,8 +53,11 @@ func createFakeVenv(args []string) {
"python stub: failed to create %q dir", binDir,
)

must(copyFile(args[0], filepath.Join(binDir, "python")), "failed to put 'python' into %q", binDir)
must(copyFile(args[0], filepath.Join(binDir, "pip")), "failed to put 'pip' into %q", binDir)
exec, err := os.Executable()
must(err, "failed to get current executable path")

must(copyFile(exec, filepath.Join(binDir, "python")), "failed to put 'python' into %q", binDir)
must(copyFile(exec, filepath.Join(binDir, "pip")), "failed to put 'pip' into %q", binDir)
}

func copyFile(src, dst string) error {
Expand Down

0 comments on commit 011f905

Please sign in to comment.