Skip to content

Commit 65d2696

Browse files
committed
fix: ensure windows file paths are processed correctly
1 parent 883cce0 commit 65d2696

File tree

5 files changed

+6
-7
lines changed

5 files changed

+6
-7
lines changed

pkg/run/run.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"fmt"
2121
"net"
2222
"os"
23-
"path"
23+
"path/filepath"
2424
"time"
2525

2626
"github.com/nitrictech/cli/pkg/utils"
@@ -60,7 +60,7 @@ func NewLocalServices(stackName, stackPath string) LocalServices {
6060
stackName: stackName,
6161
stackPath: stackPath,
6262
status: &LocalServicesStatus{
63-
RunDir: path.Join(utils.NitricRunDir(), stackName),
63+
RunDir: filepath.Join(utils.NitricRunDir(), stackName),
6464
GatewayAddress: nitric_utils.GetEnv("GATEWAY_ADDRESS", ":9001"),
6565
MembraneAddress: net.JoinHostPort("localhost", "50051"),
6666
},

pkg/runtime/golang.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func (t *golang) LaunchOptsForFunctionCollect(runCtx string) (LaunchOpts, error)
126126
return LaunchOpts{
127127
Image: t.DevImageName(),
128128
TargetWD: path.Join("/go/src", module),
129-
Cmd: strslice.StrSlice{"go", "run", "./" + t.handler},
129+
Cmd: strslice.StrSlice{"go", "run", "./" + filepath.ToSlash(t.handler)},
130130
Mounts: []mount.Mount{
131131
{
132132
Type: "bind",

pkg/runtime/javascript.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (t *javascript) LaunchOptsForFunctionCollect(runCtx string) (LaunchOpts, er
8383
return LaunchOpts{
8484
Image: t.DevImageName(),
8585
Entrypoint: strslice.StrSlice{"ts-node"},
86-
Cmd: strslice.StrSlice{"-T " + "/app/" + t.handler},
86+
Cmd: strslice.StrSlice{"-T " + "/app/" + filepath.ToSlash(t.handler)},
8787
TargetWD: "/app",
8888
Mounts: []mount.Mount{
8989
{

pkg/runtime/typescript.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func (t *typescript) LaunchOptsForFunctionCollect(runCtx string) (LaunchOpts, er
100100
return LaunchOpts{
101101
Image: t.DevImageName(),
102102
Entrypoint: strslice.StrSlice{"ts-node"},
103-
Cmd: strslice.StrSlice{"-T", "/app/" + t.handler},
103+
Cmd: strslice.StrSlice{"-T", "/app/" + filepath.ToSlash(t.handler)},
104104
TargetWD: "/app",
105105
Mounts: []mount.Mount{
106106
{

pkg/stack/options.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package stack
1919
import (
2020
"fmt"
2121
"os"
22-
"path"
2322
"path/filepath"
2423
"strings"
2524

@@ -126,7 +125,7 @@ func FromOptionsMinimal() (*Stack, error) {
126125
if err != nil {
127126
return nil, err
128127
}
129-
s := New(path.Base(absDir), sDir)
128+
s := New(filepath.Base(absDir), sDir)
130129

131130
return s, nil
132131
}

0 commit comments

Comments
 (0)